Skip to content

Commit

Permalink
creates a docs-only <ColorComponent> to allow display of separate colors
Browse files Browse the repository at this point in the history
  • Loading branch information
mdole committed Apr 16, 2019
1 parent c87246a commit 5a864f4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/palette-docs/content/docs/tokens/Color.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ See [Notion](https://www.notion.so/artsy/Color-a0c24896daf8433d9409aee2146ac267)
for more detailed spec.

<Box>
{Object.entries(themeProps.colors).map(([colorCode, hex], index) => {
return (
<Box mb={3} key={index}>
<Sans size="3" weight="medium">
{colorCode}
</Sans>
<Sans size="3">{hex}</Sans>
<Box width="100%" height={5} bg={colorCode} />
</Box>
)
})}
<ColorComponent color="black100" hex="#000" />
<ColorComponent color="black80" hex="#333" />
</Box>
2 changes: 2 additions & 0 deletions packages/palette-docs/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ module.exports = {
// gatsby-mdx. See https:/ChristopherBiscardi/gatsby-mdx/issues/243
globalScope: `
import * as Elements from "@artsy/palette"
import { ColorComponent } from "components/ColorComponent"
import { CodeEditor, Playground } from "components/Playground"
import { Toggle as Toggler } from 'react-powerplug'
export default {
CodeEditor,
ColorComponent,
Playground,
Toggler,
...Elements
Expand Down
14 changes: 14 additions & 0 deletions packages/palette-docs/src/components/ColorComponent.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from "react"
import { Box, Sans } from "@artsy/palette"

export const ColorComponent = props => {
return (
<Box mb={3}>
<Sans size="3" weight="medium">
{props.color}
</Sans>
<Sans size="3">{props.hex}</Sans>
<Box width="100%" height={5} bg={props.color} />
</Box>
)
}

0 comments on commit 5a864f4

Please sign in to comment.