Skip to content

Commit ab2341e

Browse files
authored
Merge pull request #842 from primer/color-util-tweaks
Color utility table tweaks
2 parents c32892e + 7554b3e commit ab2341e

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

docs/color-system.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import React from 'react'
22
import PropTypes from 'prop-types'
33
import chroma from 'chroma-js'
44
import styled from 'styled-components'
5-
import {Box, StyledOcticon, Text} from '@primer/components'
6-
import {Zap} from '@githubprimer/octicons-react'
5+
import {Box, Text} from '@primer/components'
76
import {colors, getPaletteByName} from './color-variables'
87
import Table from './Table'
98

@@ -60,7 +59,7 @@ export function PaletteTableFragment(props) {
6059
}
6160

6261
PaletteTable.defaultProps = {
63-
columns: ['alias', 'className', 'variable', 'value'],
62+
columns: ['alias', 'variable', 'value'],
6463
hasHeader: true
6564
}
6665

@@ -105,12 +104,12 @@ PaletteCell.propTypes = {
105104
PaletteCell.Alias = ({aliases, type, ...rest}) =>
106105
aliases && aliases[type] ? (
107106
<PaletteCell.Smart type={type} {...rest}>
108-
<StyledOcticon icon={Zap} mr={2} />
109107
<Var>.{aliases[type]}</Var>
110108
</PaletteCell.Smart>
111109
) : (
112110
<td />
113111
)
112+
114113
PaletteCell.Alias.propTypes = {
115114
aliases: PropTypes.object.isRequired,
116115
type: PropTypes.string.isRequired
@@ -128,6 +127,7 @@ PaletteCell.Smart = ({type, ...rest}) => {
128127
return <PaletteCell.Background {...rest} />
129128
}
130129
}
130+
131131
PaletteCell.Smart.propTypes = {
132132
type: PropTypes.string.isRequired
133133
}
@@ -154,6 +154,7 @@ PaletteValue.PrefixedClass = ({prefix, slug}) => (
154154
.{prefix}-{slug}
155155
</Var>
156156
)
157+
157158
PaletteValue.PrefixedClass.propTypes = {
158159
prefix: PropTypes.string.isRequired,
159160
slug: PropTypes.string.isRequired
@@ -200,7 +201,7 @@ export const Var = styled(Text).attrs({
200201
`
201202

202203
export const PaletteHeading = ({indicatorColor, children, ...rest}) => (
203-
<Text as="th" fontWeight="bold" {...rest} style={{borderBottom: `2px solid ${colors.black} !important`}}>
204+
<Text as="th" fontWeight="bold" {...rest}>
204205
<Box pt={3}>{children}</Box>
205206
</Text>
206207
)

pages/css/support/color-system.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {PaletteTable, PaletteCell, overlayColor} from '../../../docs/color-syste
4242
<StyledOcticon icon={LinkIcon} color="inherit !important" height={20} />
4343
</Flex>
4444
<PaletteTable
45-
columns={['variable', 'value' /*, 'className' */]}
45+
columns={['variable', 'value']}
4646
values={[{variable: name, value, slug: name}].concat(values)}
4747
hasHeader={false}
4848
cellPadding="8px 16px" />

pages/css/utilities/borders.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,4 @@ You can adjust border widths on all sides or each side individually with respons
231231
'variable',
232232
'value'
233233
]}
234-
borderSpacing="0 4px" />
234+
style={{borderSpacing: '0 4px'}} />

pages/css/utilities/colors.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import {palettes, allColors} from '../../../docs/color-variables'
1111
import {PaletteTable, PaletteTableFragment, PaletteHeading, PaletteCell, PaletteValue} from '../../../docs/color-system'
1212
const textColumns = [
1313
{title: 'Alias', Cell: props => <PaletteCell.Alias {...props} style={{borderBottom: `1px solid ${props.value} !important`}} />},
14-
{title: 'Class', Cell: props => <PaletteCell.Text {...props} style={{borderBottom: props.aliases.text ? `1px solid ${props.value} !important` : null}} />, Value: PaletteValue.PrefixedClass},
14+
// {title: 'Class', Cell: props => <PaletteCell.Text {...props} style={{borderBottom: props.aliases.text ? `1px solid ${props.value} !important` : null}} />, Value: PaletteValue.PrefixedClass},
1515
'variable',
1616
{title: 'Value', Cell: PaletteCell.Background, Value: PaletteValue.Value},
1717
]
1818

1919
Use color utilities to apply color to the background of elements, text, and borders.
2020

21-
# Table of contents
21+
## Table of Contents
2222

2323

2424
## Background colors
@@ -29,7 +29,7 @@ Background colors are most commonly used for filling large blocks of content or
2929

3030
<PaletteTable>
3131
{palettes.map(({name, title, value}) => (
32-
<PaletteTableFragment name={name} type="bg" key={name}>
32+
<PaletteTableFragment name={name} type="bg" sparse key={name}>
3333
<tr>
3434
<PaletteHeading indicatorColor={value} colSpan="4">
3535
{title}
@@ -133,7 +133,7 @@ You can set the color inheritance on an element by using the `text-inherit` clas
133133

134134
<PaletteTable columns={textColumns}>
135135
{palettes.map(({name, title, value}) => (
136-
<PaletteTableFragment name={name} type="text" prefix="color" columns={textColumns}>
136+
<PaletteTableFragment name={name} type="text" sparse prefix="color" columns={textColumns}>
137137
<tr>
138138
<PaletteHeading indicatorColor={value} colSpan="4">
139139
{title}

0 commit comments

Comments
 (0)