1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
import * as React from "react"; import { storiesOf } from "@storybook/react"; import { css } from "emotion"; import { typography, constants } from "pebble-web/src"; import { Colors } from "../src/theme/typings/colors"; import { colors } from "pebble-shared"; const wrapper = css({ padding: 30, minHeight: "100vh", width: "100vw", backgroundColor: colors.gray.lightest }); const titleStyle = css({ display: "flex", flexDirection: "column", color: colors.gray.dark, fontWeight: "bold", width: "100%", "> div": { padding: "10px 20px" } }); const section = css({ width: 150, float: "left", border: constants.border.base, borderRadius: constants.borderRadius, marginBottom: 20, backgroundColor: colors.white.base, overflow: "hidden", marginRight: 20 });
storiesOf("Theme/colors", module).add("List", () => ( <div className={wrapper}> <h2 style={{ marginBottom: 40 }}>Colors</h2> {Object.keys(colors).map(x => { const group = colors[x as keyof Colors]; return ( <div key={x}> <h4 style={{ marginBottom: 10 }}>{x}</h4> <div style={{ overflow: "auto" }}> {Object.keys(colors[x as keyof Colors]).map(y => { const color = group[y as keyof typeof group]; return ( <div className={section} key={y}> <div style={{ backgroundColor: color, flex: 1, height: 100 }} /> <div className={titleStyle}> <div style={{ borderBottom: constants.border.base }}> {color} </div> <div style={typography.s.light}>{`colors.${x}.${y}`}</div> </div> </div> ); })} </div> </div> ); })} </div> ));