Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// $FlowFixMe
; // Missing foo
// $FlowFixMe
; // Wrong foo
// $FlowFixMe
; // Missing bar
// $FlowFixMe
; // Wrong bar
// $FlowFixMe
; // Missing baz
// $FlowFixMe
; // Wrong baz
;
const Qux = withStyle(Baz, (_props: {qux: "qux"}) => ({color: "red"}));
// $FlowFixMe
; // Missing foo
// $FlowFixMe
; // Wrong foo
// $FlowFixMe
; // Missing bar
// $FlowFixMe
; // Wrong bar
// $FlowFixMe
; // Missing baz
// $FlowFixMe
; // Wrong baz
// $FlowFixMe
; // Missing qux
// $FlowFixMe
),
);
// $FlowFixMe
; // missing foo and bar
// $FlowFixMe
; // missing bar
// $FlowFixMe
; // missing foo
;
const Baz = withStyle(Bar, (props: {foo: "foo", bar: "bar", baz: "baz"}) => ({
color: props.baz,
}));
// $FlowFixMe
; // Missing foo
// $FlowFixMe
; // Wrong foo
// $FlowFixMe
; // Missing bar
// $FlowFixMe
; // Wrong bar
// $FlowFixMe
; // Missing baz
// $FlowFixMe
; // Wrong baz
// withWrapper()
// --------------------------
const PrettyButton = styled('button', { background: 'green' });
const { Consumer } = React.createContext(true);
const WithWrapped = withWrapper(PrettyButton, Styled => props => (
{value => }
));
;
// Style composition still works as normal;
const StyledWithWrapper = withStyle(WithWrapped, { background: 'red' });
;
//
// --------------------------
const engineNoop = (arg: any) => (arg ? '' : '');
const engine: StandardEngine = {
renderStyle: engineNoop,
renderKeyframes: engineNoop,
renderFontFace: engineNoop,
};
const App = () => (
;
// withStyle()
// --------------------------
// Static Styles
const WithStyledSimple = withStyle(BasicStyled, { color: 'blue' });
;
// Dynamic Styles
interface WithStyledDynamicProps {
$crushed: boolean;
}
const WithStyledDynamic = withStyle(BasicStyled, (props: WithStyledDynamicProps) => ({
letterSpacing: props.$crushed ? '-5px' : '0',
}));
;
// withStyleDeep()
// --------------------------
// Static Styles
const WithStyledDeepSimple = withStyleDeep(BasicStyled, { color: 'blue' });
;
// Dynamic Styles
interface WithStyledDeepDynamicProps {
$crushed: boolean;
import {styled, withStyle, withWrapper} from "styletron-react";
// Note: explicit generic annotation is here because this is not inferred correctly
const Foo = styled<{foo: "foo"}>("div", (_props: {foo: "foo"}) => ({
color: "red",
}));
// $FlowFixMe
; // Missing foo
// $FlowFixMe
; // Wrong foo
;
const Bar = withStyle(Foo, (_props: {bar: "bar"}) => ({color: "red"}));
// $FlowFixMe
; // Missing foo
// $FlowFixMe
; // Wrong foo
// $FlowFixMe
; // Missing bar
// $FlowFixMe
; // Wrong bar
;
const Baz = withStyle(Bar, (_props: {baz: "baz"}) => ({color: "red"}));
// $FlowFixMe
; // Missing foo
import {withStyle} from 'styletron-react';
import {Button, KIND, SIZE} from 'baseui/button';
import {ButtonGroup} from 'baseui/button-group';
import {Card} from 'baseui/card';
import {Block} from 'baseui/block';
import {StyledLink} from 'baseui/link';
import {version} from '../../package.json';
import Code from './code';
import CodeIcon from './code-icon';
//$FlowFixMe
import {trackEvent} from '../helpers/ga';
import {H3} from './markdown-elements';
import {codesandboxIndexCode} from './const';
const Link = withStyle(StyledLink, {cursor: 'pointer'});
function Source(props: {children: ?React.Node}) {
if (!props.children || typeof props.children !== 'string') return null;
return <code>{props.children}</code>;
}
type PropsT = {
additionalPackages: {[string]: string},
children: React.Node,
path: string, // required to fetch the uncompiled source code
title: ?string,
};
type StateT = {
sourceSelected: number,
source: ?string,
// @flow
import React from 'react';
import {withStyle} from 'styletron-react';
import {StatefulMenu, OptionList, StyledList} from 'baseui/menu';
import List from 'react-virtualized/dist/commonjs/List';
import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer';
const ITEMS = [...new Array(1500)].map((_, index) => ({
label: `item number: ${index + 1}`,
}));
const Container = withStyle(StyledList, {height: '500px'});
const VirtualList = React.forwardRef((props, ref) => {
const children = React.Children.toArray(props.children);
return (
{({width}) => (
(
const Button = styled('button', ({$theme}) => {
return {
...$theme.typography.font300,
display: 'block',
paddingTop: '10px',
paddingRight: '12px',
paddingBottom: '10px',
paddingLeft: '12px',
marginTop: '8px',
width: '100%',
borderRadius: $theme.sizing.scale100,
borderWidth: 'none',
};
});
const TextareaWithStyle = withStyle(StyledTextarea, props => {
const {
$disabled,
$error,
$isFocused,
$theme: {colors, sizing},
} = props;
return {
borderColor: $disabled
? colors.borderAlt
: $error
? colors.borderError
: $isFocused
? 'darkseagreen'
: colors.border,
boxShadow: `0 0 ${sizing.scale100} ${
$disabled
[examples.STYLES_OVERRIDES]: () => {
const overrides = {
RadioMark: {
style: {borderColor: 'red'},
},
Label: withStyle(StyledLabel, () => {
return {
color: 'orange',
fontSize: '25px',
};
}),
};
return (
First
Second
Third
);
},
[examples.WITH_ERROR]: () => {
[examples.STYLES_OVERRIDES]: () => {
return (
{
return {
border: `1px solid green`,
padding: '10px',
};
}),
Label: withStyle(StyledLabel, () => {
return {
color: 'orange',
fontSize: '25px',
};
}),
Checkmark: withStyle(StyledCheckmark, props => {
const {checked} = props;
return checked
? {borderColor: 'pink'}
: {