import * as React from 'react'; import * as variables from './variables'; import mdNotes from './colors.md'; const bdlColors: { [k: string]: Array> } = {}; Object.keys(variables).forEach(colorKey => { const color = (variables as { [k: string]: string | Array })[colorKey]; if ( colorKey.startsWith('bdl') && !colorKey.includes('Neutral') && colorKey !== 'bdlSecondaryBlue' && !Array.isArray(color) && color.startsWith('#') ) { const colorNameBreakDown = (colorKey.match(/(bdl)|([A-Z][a-z]+)|(\d+)/g) as Array).join('-'); const allowColorKey = (colorKey.match(/[A-Z][a-z]+/g) as Array).join(' '); if (!bdlColors[allowColorKey]) { bdlColors[allowColorKey] = []; } bdlColors[allowColorKey].push([colorNameBreakDown, color, colorKey]); } }); const wrapper = { margin: '20px', }; const palette: React.CSSProperties = { display: 'flex', flexDirection: 'row', flexWrap: 'wrap', margin: '20px 10px', }; const swatch = { borderRadius: '3px', height: '40px', marginBottom: '4px', width: '200px', }; const swatchContainer = { margin: '10px', }; const label = { margin: '3px 0 5px', }; const Swatch = ({ color }: { color: Array }) => (
); const SwatchSection = ({ swatchColor }: { swatchColor: string }) => (
{bdlColors[swatchColor].map(color => ( ))}
); const allColors = () => (

White

Black

{Object.keys(bdlColors).map(key => (

{key}

{bdlColors[key].map(color => ( ))}
))}
); const boxBlue = () => ; const gray = () => ; const darkBlue = () => ; const lightBlue = () => ; const yellorange = () => ; const yellow = () => ; const grimace = () => ; const greenLight = () => ; const purpleRain = () => ; const watermelonRed = () => ; export { allColors, boxBlue, gray, darkBlue, lightBlue, yellorange, yellow, greenLight, grimace, purpleRain, watermelonRed, }; export default { title: 'Theming|Colors', parameters: { notes: mdNotes, }, };