Using grey color by default for some Semantic elements when no color is provided.

This commit is contained in:
Roland 2022-09-29 14:58:16 -06:00
parent 335ad7ceb0
commit d82b7c12fb
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
6 changed files with 143 additions and 138 deletions

View file

@ -105,21 +105,29 @@ const invertedNull = (props) => {
return props;
}
const defaultGrey = (props, inverted) => {
// Some elements look softer when grey, use grey only if another color is not provided.
if (inverted) {
return {color: 'grey', ...props};
}
return props;
}
export function Button(props) {
const {i} = useContext(ThemeContext);
props = {...i, ...props};
const {i, inverted} = useContext(ThemeContext);
props = defaultGrey({...i, ...props}, inverted);
return <BUTTON {...props}/>
}
export function Accordion(props) {
const {i} = useContext(ThemeContext);
props = {...i, ...props};
const {i, inverted} = useContext(ThemeContext);
props = defaultGrey({...i, ...props}, inverted);
return <ACCORDION {...props}/>
}
export function Header(props) {
const {i} = useContext(ThemeContext);
props = {...i, ...props};
const {i, inverted} = useContext(ThemeContext);
props = defaultGrey({...i, ...props}, inverted);
return <HEADER {...props}/>
}
@ -191,8 +199,8 @@ export function Segment(props) {
}
export function Statistic(props) {
const {i} = useContext(ThemeContext);
props = {...i, ...props};
const {i, inverted} = useContext(ThemeContext);
props = defaultGrey({...i, ...props}, inverted);
return <STATISTIC {...props}/>
}