Skip to content

Commit

Permalink
feat(Grid): add inverted prop and usage example to docs (#1677)
Browse files Browse the repository at this point in the history
* add inverted prop to Grid, add inverted Grid example

* add test for inverted prop, move example position
  • Loading branch information
josie11 authored and levithomason committed May 14, 2017
1 parent f05ab54 commit b2eaa7a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react'
import { Grid, Segment } from 'semantic-ui-react'

const GridExampleInverted = () => (
<Grid columns='equal' divided inverted padded>
<Grid.Row color='black' textAlign='center'>
<Grid.Column>
<Segment color='black' inverted >1</Segment>
</Grid.Column>
<Grid.Column>
<Segment color='black' inverted>2</Segment>
</Grid.Column>
<Grid.Column>
<Segment color='black' inverted>3</Segment>
</Grid.Column>
</Grid.Row>
</Grid>
)

export default GridExampleInverted
6 changes: 6 additions & 0 deletions docs/app/Examples/collections/Grid/Variations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ const GridVariationsExamples = () => (
/>
<ComponentExample examplePath='collections/Grid/Variations/GridExampleColoredRow' />

<ComponentExample
title='Inverted'
description='A grid can be inverted to allow dividers to be seen with a dark background.'
examplePath='collections/Grid/Variations/GridExampleInverted'
/>

<ComponentExample
title='Centered'
description='A grid can have its columns centered.'
Expand Down
3 changes: 3 additions & 0 deletions src/collections/Grid/Grid.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export interface GridProps {
/** A grid can double its column width on tablet and mobile sizes. */
doubling?: boolean;

/** A grid's colors can be inverted. */
inverted?: boolean;

/** A grid can preserve its vertical and horizontal gutters on first and last columns. */
padded?: boolean | 'horizontally' | 'vertically';

Expand Down
5 changes: 5 additions & 0 deletions src/collections/Grid/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function Grid(props) {
container,
divided,
doubling,
inverted,
padded,
relaxed,
reversed,
Expand All @@ -45,6 +46,7 @@ function Grid(props) {
useKeyOnly(centered, 'centered'),
useKeyOnly(container, 'container'),
useKeyOnly(doubling, 'doubling'),
useKeyOnly(inverted, 'inverted'),
useKeyOnly(stackable, 'stackable'),
useKeyOnly(stretched, 'stretched'),
useKeyOrValueAndKey(celled, 'celled'),
Expand Down Expand Up @@ -106,6 +108,9 @@ Grid.propTypes = {
/** A grid can double its column width on tablet and mobile sizes. */
doubling: PropTypes.bool,

/** A grid's colors can be inverted. */
inverted: PropTypes.bool,

/** A grid can preserve its vertical and horizontal gutters on first and last columns. */
padded: PropTypes.oneOfType([
PropTypes.bool,
Expand Down
1 change: 1 addition & 0 deletions test/specs/collections/Grid/Grid-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('Grid', () => {
common.propKeyOnlyToClassName(Grid, 'centered')
common.propKeyOnlyToClassName(Grid, 'container')
common.propKeyOnlyToClassName(Grid, 'doubling')
common.propKeyOnlyToClassName(Grid, 'inverted')
common.propKeyOnlyToClassName(Grid, 'stackable')
common.propKeyOnlyToClassName(Grid, 'stretched')

Expand Down

0 comments on commit b2eaa7a

Please sign in to comment.