How to use the styled-components.withTheme function in styled-components

To help you get started, we’ve selected a few styled-components examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flow-typed / flow-typed / definitions / npm / styled-components_v2.x.x / flow_v0.42.x-v0.52.x / test_styled-components_v2.x.x.js View on Github external
}

const StyledClass: ReactComponentClass<{ foo: string, theme: Theme }> = styled(NeedsThemeReactClass)`
  color: red;
`;

const NeedsFoo1Class: ReactComponentClass<{ foo: string }, { theme: Theme }> = withTheme(NeedsThemeReactClass);

// $ExpectError
const NeedsFoo0ClassError: ReactComponentClass<{ foo: string }> = withTheme(ReactClass);
// $ExpectError
const NeedsFoo1ClassError: ReactComponentClass<{ foo: string }> = withTheme(NeedsFoo1Class);
// $ExpectError
const NeedsFoo1ErrorClass: ReactComponentClass<{ foo: number }> = withTheme(NeedsThemeReactClass);
// $ExpectError
const NeedsFoo2ErrorClass: ReactComponentClass<{ foo: string }, { theme: string }> = withTheme(NeedsThemeReactClass);
// $ExpectError
const NeedsFoo3ErrorClass: ReactComponentClass<{ foo: string, theme: Theme }> = withTheme(NeedsFoo1Class);
// $ExpectError
const NeedsFoo4ErrorClass: ReactComponentClass<{ foo: number }> = withTheme(NeedsFoo1Class);
// $ExpectError
const NeedsFoo5ErrorClass: ReactComponentClass<{ foo: string, theme: string }> = withTheme(NeedsFoo1Class);

// ---- INTERPOLATION TESTS ----
const interpolation: Array = styled.css`
  background-color: red;
`;

// $ExpectError
const interpolationError: Array = styled.css`
  background-color: red;
`;
github LedgerHQ / ledger-live-desktop / src / components / base / Chart / index.js View on Github external
/>
      
    )
  }
}

const Ruler = styled.div.attrs(({ height }) => ({
  style: {
    height,
  },
}))`
  position: relative;
  width: 100%;
`

export default withTheme(Chart)
github chingu-voyage6 / grad.then / src / components / PageNav.js View on Github external
activeClassName="activeLink">
            {elem}
          
        
      ))}
    
  )
}

PageNav.propTypes = {
  header: PropTypes.bool.isRequired,
  nav: PropTypes.array.isRequired,
  theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
}

export default withTheme(PageNav)
github dexma / ui-components / src / components / Grid.js View on Github external
*/
  children: PropTypes.node,
};

const defaultProps = {
  theme: theme,
};

export const Grid = props => ;

StyledGrid.displayName = 'StyledGrid';

Grid.propTypes = propTypes;
Grid.defaultProps = defaultProps;

export default memo(withTheme(Grid));
github coderplanets / coderplanets_web / containers / UsersThread / GeoMap.js View on Github external
<div id="{this.chartId}">
        
      
    )
  }
}

export default withTheme(LocationMap)

/*
   fetch('http://antvis.github.io/static/data/china-pm.json')
   .then(response =&gt; response.json())
   .then(data =&gt; {})
 */
</div>
github opencollective / opencollective-frontend / components / VirtualCardDetails.js View on Github external
{this.state.expended ? (
                  
                ) : (
                  
                )}
              
            
          
          {this.state.expended &amp;&amp; this.renderDetails()}
        
      
    );
  }
}

export default withTheme(VirtualCardDetails);
github bootstrap-styled / v4 / src / Fade / index.js View on Github external
appear: 'fade',
          appearActive: 'show',
          enter: 'fade',
          enterActive: 'show',
          leave: 'fade',
        }}
        {...rest}
      &gt;
        {isOpen ? children : null}
      
    );
  }
}

Fade.defaultProps = defaultProps;
export default withTheme(Fade);
github treebohotels / leaf-ui / src / TextInput / TextInput.native.js View on Github external
};

TextInput.defaultProps = {
  name: '',
  label: '',
  placeholder: '',
  error: '',
  leftIcon: null,
  rightIcon: null,
};

TextInput.contextTypes = {
  formik: PropTypes.object,
};

export default withTheme(TextInput);
github ZcashFoundation / zepio / app / views / send.js View on Github external
{this.renderModalContent({
                  valueSent,
                  valueSentInUsd,
                  toggle,
                })}
              
            )}
          
          
        
      
    );
  }
}

export const SendView = withTheme(Component);
github LedgerHQ / ledger-live-desktop / src / components / CryptoCurrencyIcon.js View on Github external
}
    if (currency.type === 'TokenCurrency') {
      return (
        
          
            {currency.ticker[0]}
          
        
      )
    }
    const IconCurrency = getCryptoCurrencyIcon(currency)
    return IconCurrency ?  : null
  }
}

export default withTheme(CryptoCurrencyIcon)