@material-ui/styles#withTheme JavaScript Examples
The following examples show how to use
@material-ui/styles#withTheme.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Styled.jsx From jafar with MIT License | 6 votes |
FieldLink = withTheme(styled.a`
flex: 1;
text-decoration: none;
cursor: pointer;
color: ${props => props.theme.palette.secondary.main};
&:hover {
text-decoration: underline;
}
`)
Example #2
Source File: Styled.jsx From jafar with MIT License | 6 votes |
Link = withTheme(styled.a`
flex: 1;
text-decoration: none;
cursor: pointer;
color: ${props => props.theme.palette.secondary.main};
&:hover {
text-decoration: underline;
}
`)
Example #3
Source File: Styled.jsx From jafar with MIT License | 6 votes |
Link = withTheme(styled.a`
flex: 1;
text-decoration: none;
cursor: pointer;
color: ${props => props.theme.palette.secondary.main};
&:hover {
text-decoration: underline;
}
`)
Example #4
Source File: Styled.jsx From jafar with MIT License | 6 votes |
Action = withTheme(styled.a`
border: 1px solid ${props => props.theme.palette.secondary.main};
border-radius: 3px;
color: ${props => props.theme.palette.secondary.main};
display: inline-block;
font-size: 14px;
font-weight: 400;
line-height: 1.2em;
padding: 10px;
text-decoration: none!important;
text-transform: uppercase;
-webkit-transition: background .3s,color .3s;
transition: background .3s,color .3s;
width: 100%;
text-align: center;
margin-right: 20px;
padding: 30px 0 50px 0;
&:hover {
text-decoration: none;
cursor: pointer;
background: ${props => props.theme.palette.secondary.main};
color: #ffffff;
}
svg {
height: 40px;
width: 40px;
margin-bottom: 10px;
}
`)
Example #5
Source File: Term.jsx From jafar with MIT License | 5 votes |
ConditionalTerm = ({ value = defaultConditionalTerm, onValueChange }) => {
const AddButton = withTheme(styled.div`
margin-top: 15px;
display: inline-block;
cursor: pointer;
color: ${props => props.theme.palette.secondary.main};
`);
const SubTermWrapper = styled.div`
padding-bottom: 40px;
border-bottom: 2px dashed #e1e1e1;
margin: 40px 0 40px 70px;
`;
const onNotChanged = (not) => {
const newValue = { ...value };
if (not) {
newValue.not = not;
} else {
delete newValue.not;
}
onValueChange(newValue);
};
const onOperatorChanged = (operator) => {
const newValue = { ...value, operator };
onValueChange(newValue);
};
const addTerm = () => {
const newValue = { ...value };
newValue.terms = [...newValue.terms];
newValue.terms.push({});
onValueChange(newValue);
};
const onTermValueChange = (termValue, index) => {
const newValue = { ...value };
newValue.terms = [...newValue.terms];
if (!termValue) {
newValue.terms.splice(index, 1);
} else {
newValue.terms[index] = termValue || {};
}
onValueChange(newValue);
};
const operatorItems = [
{ label: 'Or', value: 'or' },
{ label: 'And', value: 'and' },
];
return (<TermWrapper>
<Checkbox value={value.not} state={{ label: 'Not' }} onValueChange={onNotChanged} />
<Select value={value.operator} required={true} state={{ items: operatorItems }} onValueChange={onOperatorChanged} />
{
value.terms.map((term, index) => (<SubTermWrapper key={index}><Term
value={term}
onValueChange={(validatorValue, isCustom) => onTermValueChange(validatorValue, index)}
/>
</SubTermWrapper>))
}
<AddButton aria-label="add-term" onClick={addTerm}>+ Add term</AddButton>
</TermWrapper>);
}
Example #6
Source File: Validators.jsx From jafar with MIT License | 5 votes |
AddButton = withTheme(styled.div`
display: inline-block;
cursor: pointer;
color: ${props => props.theme.palette.secondary.main};
`)