Skip to content

Commit

Permalink
feat(grid): Add new grid documentation (#2859)
Browse files Browse the repository at this point in the history
* chore(documentation): grid dockblocks

* chore(grids): remove mixins, move deprecated styles to deprecate file and include

* feat(grids): Add docblocks part 1

* Continue

* chore(grids): Finish documentation

* Remove Example wrapper for now

* feat(grids): Fix linting errors

* Add missing sections, fix build

* Remove comment

* Add tests

* Add tests

* Updated documentation text

* Update blockquote text

* Update snapshot refs

* Update headings
  • Loading branch information
brandonferrua authored Dec 12, 2017
1 parent e2b4fef commit 02854fd
Show file tree
Hide file tree
Showing 32 changed files with 4,587 additions and 0 deletions.
4 changes: 4 additions & 0 deletions shared/styles/doc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ p.doc {
margin-bottom: 1.5rem;
}

p.doc:first-child {
margin-top: 0;
}

a.doc {
color: #0070d2;
}
Expand Down
75 changes: 75 additions & 0 deletions test/__tests__/__snapshots__/Grid_Column_Gutters_2_col_basic.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

112 changes: 112 additions & 0 deletions test/__tests__/__snapshots__/Grid_Column_Nesting.json

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions test/__tests__/__snapshots__/Grid_Column_Reordering_3_col.json

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions test/__tests__/__snapshots__/Grid_Column_Width_2_col.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

949 changes: 949 additions & 0 deletions test/__tests__/__snapshots__/Grid_Column_Width_all_options.json

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions test/__tests__/__snapshots__/Grid_Column_Wrapping_3_col.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions test/__tests__/__snapshots__/Grid_Horizontal_Align_end.json

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions test/__tests__/__snapshots__/Grid_Horizontal_Align_spaced.json

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions test/__tests__/__snapshots__/Grid_Horizontal_Align_spread.json

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions test/__tests__/__snapshots__/Grid_Horizontal_Reversed.json

Large diffs are not rendered by default.

305 changes: 305 additions & 0 deletions test/__tests__/__snapshots__/Grid_Intro_12_col.json

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions test/__tests__/__snapshots__/Grid_Intro_3_col_with_gutters.json

Large diffs are not rendered by default.

121 changes: 121 additions & 0 deletions test/__tests__/__snapshots__/Grid_Intro_4_col_with_gutters.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions test/__tests__/__snapshots__/Grid_Vertical_Align.json

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions test/__tests__/__snapshots__/Grid_Vertical_Align_absolute_center.json

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions test/__tests__/__snapshots__/Grid_Vertical_Align_center.json

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions test/__tests__/__snapshots__/Grid_Vertical_Align_end.json

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions test/__tests__/__snapshots__/Grid_Vertical_Align_inidividual.json

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions test/__tests__/__snapshots__/Grid_Vertical_Align_reversed.json

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions test/__tests__/__snapshots__/Grid_Vertical_Align_start.json

Large diffs are not rendered by default.

461 changes: 461 additions & 0 deletions ui/utilities/grid/docs.mdx

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions ui/utilities/grid/docs/Grid.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license

import React, { Component } from 'react';
import CodeView from '../../../../shared/components/CodeView';
import style from './Grid.scss';
import classNames from 'classnames';

export const Column = props => {
let count = props.count + 1;
return (
<div className={classNames('slds-col', props.className)}>
{props.count >= 0 ? <span>{count}</span> : <span>{props.children}</span>}
</div>
);
};

class Grid extends Component {
render() {
const children = [];
for (var i = 0; i < this.props.columns; i += 1) {
children.push({ key: i, count: i });
}
return (
<div
className={classNames(
'simple-grid',
this.props.small && 'simple-grid_small'
)}
>
<CodeView>
<div
className={classNames('slds-grid', this.props.className)}
style={this.props.style}
>
{this.props.columns
? children.map(props => <Column key={props.key} {...props} />)
: this.props.children}
</div>
</CodeView>
</div>
);
}
}

export default Grid;
39 changes: 39 additions & 0 deletions ui/utilities/grid/docs/Grid.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// stylelint-disable selector-class-pattern
.simple-grid .slds-grid {
height: 8.75rem;
margin-bottom: 1rem;
}

.simple-grid_small .slds-grid {
height: auto;
}

.simple-grid .slds-grid > .slds-grid {
height: auto;
margin-bottom: 0;
}

.simple-grid .slds-col {
display: inline-flex;
background: #54698d;
color: #fff;
text-align: center;
background-clip: content-box;
border: 1px solid #fff;
border-radius: 0;
}

.simple-grid .slds-col > span {
align-self: center;
margin: auto;
font-size: 1.575rem;
padding: 0.5rem;
}

.simple-grid .slds-wrap {
align-items: stretch;
}

.simple-grid__buttons {
margin: auto;
}

0 comments on commit 02854fd

Please sign in to comment.