Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function cssRequiredTest() {
function styleRequiredFunction(props: { color: string }) {
return {};
}
const style = css(styleRequiredFunction);
style({
color: 'red',
css: {}, // $ExpectError
});
style({ css: { color: 'red' } }); // $ExpectError
style({ color: 'blue', css: { color: 'red' } });
}
function cssTest() {
function styleFunction(props: { color?: string; spacing?: number; theme?: object }) {
return {};
}
const wideOrNarrowStyleFunction = css(styleFunction);
// narrow
wideOrNarrowStyleFunction({ theme: {}, css: { color: 'blue', spacing: 2 } });
// wide, undesire: `css` is required, marking it as optional breaks system/basics/#css-property
wideOrNarrowStyleFunction({ theme: {}, color: 'blue', spacing: 2, css: {} });
// wide and narrow
wideOrNarrowStyleFunction({ theme: {}, css: { color: 'blue', spacing: 2 }, color: 'red' });
}
import {
borders,
compose,
display,
flexbox,
palette,
positions,
shadows,
sizing,
spacing,
typography,
css,
} from '@material-ui/system';
import styled from '../styles/styled';
export const styleFunction = css(
compose(
borders,
display,
flexbox,
positions,
palette,
shadows,
sizing,
spacing,
typography,
),
);
/**
* @ignore - do not document.
*/
import React from 'react';
import styled, { ThemeProvider } from 'styled-components';
import NoSsr from '@material-ui/core/NoSsr';
import { createMuiTheme } from '@material-ui/core/styles';
import { compose, spacing, palette, css } from '@material-ui/system';
const Box = styled.div`
${css(
compose(
spacing,
palette,
),
)}
`;
const theme = createMuiTheme();
export default function CssProp() {
return (
CssProp
import React from 'react';
import styled, { ThemeProvider } from 'styled-components';
import NoSsr from '@material-ui/core/NoSsr';
import { createMuiTheme } from '@material-ui/core/styles';
import { compose, spacing, palette, css } from '@material-ui/system';
const Box = styled.div`
${css(
compose(
spacing,
palette,
),
)}
`;
const theme = createMuiTheme();
function CssProp() {
return (
CssProp