Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
35f89fa
Rename variables to not include packages, as that terminology is spec…
bernardwang Apr 16, 2020
6661fb7
Move doc files to design-system-docs folder
bernardwang Apr 17, 2020
6fda30a
Reorganize design-system src into scripts and styles
bernardwang Apr 17, 2020
2bb44b7
S
bernardwang Apr 23, 2020
b6d98f0
Move remaining react component descriptions to design-system-docs
bernardwang Apr 23, 2020
7a5affb
Fix example file imports
bernardwang Apr 23, 2020
d677d6a
Get react docs to work, replace '@react-component' with '@react-props…
bernardwang Apr 23, 2020
3456a33
Update doc site react files
bernardwang Apr 23, 2020
ccb9b95
Rename addReactDocProps to addReactDocs
bernardwang Apr 23, 2020
1fe6b0c
Update KSS files to use new tags
bernardwang Apr 23, 2020
fd6b9b3
Update documentation on writing documentation
bernardwang Apr 23, 2020
f038b86
Merge remote-tracking branch 'origin/master' into WNMGDS-437/move-doc…
bernardwang Apr 24, 2020
6696a96
Move remaining doc files to docs package, combine grid scss files
bernardwang Apr 24, 2020
bcc1111
Update doc generation to only look at the docs dir
bernardwang Apr 24, 2020
512ed46
Merge branch 'master' into WNMGDS-437/move-doc-files
bernardwang Apr 27, 2020
c229389
Fix import paths for component and utility scss files
bernardwang Apr 27, 2020
f29aec0
Update reactdocs temp file structure to be simpler, update usage of g…
bernardwang Apr 27, 2020
424dbba
Update page override logging
bernardwang Apr 27, 2020
aaf8947
Run linter
bernardwang Apr 27, 2020
8faccf7
Rename component/utility scss files to be scss partials, update build…
bernardwang Apr 27, 2020
3998d89
Fix View source links for react components to work for core and child DS
bernardwang Apr 28, 2020
1b96920
Update gulp watch task
bernardwang Apr 28, 2020
0316449
Merge remote-tracking branch 'origin/master' into WNMGDS-437/move-doc…
bernardwang Apr 28, 2020
a116e96
Fix child DS scss and js compiling
bernardwang Apr 29, 2020
62ad672
Merge remote-tracking branch 'origin/master' into WNMGDS-437/move-doc…
bernardwang Apr 29, 2020
3c86455
Add compileJs to watch task temporarily
bernardwang Apr 29, 2020
1b9bd71
Merge branch 'master' into WNMGDS-437/move-doc-files
bernardwang Apr 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 10 additions & 8 deletions guides/WRITING-DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ To extend the default functionality of KSS, we've implemented support for custom

Supported flags:

- **`@hide-example`** Hides the example and code snippet. Useful for rendering just the prop docs for React components.
- **`@hide-markup`** Hides the code snippet.
- **`@react-component [NAME]`** Displays the React `.jsx` component example, documentation and `Props`.
- **`@react-props [NAME]`** Displays the React prop documentation for a component.

- **Example**: `@react-component Button` or `@react-component core/src/Components/Button/Button`.
- `[NAME]` is a component's name relative to the source documentation file, or a path (without a file extension) relative to `packages`. See [File naming](#file-naming) for more info.
- **Example**: `@react-props Button.jsx`
- `[NAME]` is the filename of the react component where the `Proptypes` are defined.

- **`@react-example [NAME]`** Displays example.jsx file using this React component.
- **`@react-example [NAME]`** Displays the example file using this React component.

- **Example**: `@react-component Mask` displays `Mask.example.jsx`
- **Example**: `@react-props Mask` displays `Mask.example.jsx`
- `[NAME]` is the filename of the react example to be displayed

- **`@responsive`** Renders breakpoint toggles for the markup example.
- **`@status [NAME]`** Displays a status badge. Supported values: `Draft`, `Work in progress`, `Ready`, `Deprecated`.
Expand Down Expand Up @@ -154,7 +154,9 @@ Buttons

Use buttons to signal actions.

@react-component Button
@react-example Button.example.jsx

@react-props Button.jsx

Markup: button.example.html

Expand Down Expand Up @@ -211,7 +213,7 @@ Button.propTypes = {
/**
* Overwrite the button's `class` attribute by providing your own
*/
className: React.PropTypes.string
className: React.PropTypes.string,
};
```

Expand Down
4 changes: 2 additions & 2 deletions packages/design-system-docs/src/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ function setModalExamples() {
const dialogHeading = document.getElementById('dialog-heading');
const dialogWrap = document.getElementById('dialog-wrap');

document.querySelectorAll('.dialog-open-btn').forEach(btn => {
document.querySelectorAll('.dialog-open-btn').forEach((btn) => {
btn.addEventListener('click', () => {
dialog.classList.add(btn.dataset.type);
dialogHeading.textContent = btn.dataset.heading;
dialogWrap.classList.remove('ds-u-display--none');
});
});
document.querySelectorAll('.dialog-close-btn').forEach(btn => {
document.querySelectorAll('.dialog-close-btn').forEach((btn) => {
btn.addEventListener('click', () => {
dialog.className = 'ds-c-dialog';
dialogWrap.classList.add('ds-u-display--none');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Alert from './Alert';
import { Alert } from '@cmsgov/design-system';
import React from 'react';
import ReactDOM from 'react-dom';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Style guide: components.alert.variations
/*
`<Alert>`

@react-component Alert
@react-example Alert.example.jsx

@react-props Alert.jsx

Style guide: components.alert.react
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
import Autocomplete from './Autocomplete';
import { Autocomplete, TextField } from '@cmsgov/design-system';
import React from 'react';
import ReactDOM from 'react-dom';
import TextField from '../TextField/TextField';

ReactDOM.render(
<div>
<Autocomplete
items={[
{
id: 'kRf6c2fY',
name: 'Cook County, IL'
name: 'Cook County, IL',
},
{
id: 'lYf5cGfM',
name: 'Cook County, MD'
name: 'Cook County, MD',
},
{
id: 'mZfKcGf9',
name: 'Cook County, TN'
name: 'Cook County, TN',
},
{
id: 'xFz6dLba',
name: 'Cook County, AK'
name: 'Cook County, AK',
},
{
id: 'vTr5c99',
name: 'Cook County, FL'
name: 'Cook County, FL',
},
{
id: 'ntY8Lha',
name: 'Cook County, AL'
name: 'Cook County, AL',
},
{
id: 'uRe0Wqo',
name: 'Cook County, WA'
name: 'Cook County, WA',
},
{
id: 'yUR7MWl',
name: 'Cook County, OR'
}
name: 'Cook County, OR',
},
]}
label="Select from the options below:"
onChange={selectedItem => console.log(selectedItem)}
onInputValueChange={inputVal => console.log('[Autocomplete]: ' + inputVal)}
onChange={(selectedItem) => console.log(selectedItem)}
onInputValueChange={(inputVal) => console.log('[Autocomplete]: ' + inputVal)}
>
<TextField
hint="Type c then use ARROW keys to change options, ENTER key to make a selection, ESC to dismiss."
Expand All @@ -55,19 +54,19 @@ ReactDOM.render(
items={[
{
id: 'kRf6c2fY',
name: 'Cook County, IL'
name: 'Cook County, IL',
},
{
id: 'lYf5cGfM',
name: 'Cook County, MD'
name: 'Cook County, MD',
},
{
id: 'mZfKcGf9',
name: 'Cook County, TN'
}
name: 'Cook County, TN',
},
]}
onChange={selectedItem => console.log(selectedItem)}
onInputValueChange={inputVal => console.log('[Autocomplete]: ' + inputVal)}
onChange={(selectedItem) => console.log(selectedItem)}
onInputValueChange={(inputVal) => console.log('[Autocomplete]: ' + inputVal)}
>
<TextField
hint="Type c then use ARROW keys to change options, ENTER key to make a selection, ESC to dismiss."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ Style guide: components.autocomplete
/*
`<Autocomplete>`

@react-component Autocomplete
The `Autocomplete` component is a parent component that adds autocomplete functionality to a `TextField` component.

@react-example Autocomplete.example.jsx

@react-props Autocomplete.jsx

Style guide: components.autocomplete.react
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment } from 'react';
import Badge from './Badge';
import { Badge } from '@cmsgov/design-system';
import ReactDOM from 'react-dom';

ReactDOM.render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ Style guide: components.badge
/*
`<Badge>`

@react-component Badge
@react-example Badge.example.jsx

@react-props Badge.jsx

Style guide: components.badge.react
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint no-alert: 0 */
import React, { Fragment } from 'react';
import Button from './Button';
import { Button } from '@cmsgov/design-system';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import classNames from 'classnames';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,18 @@ Style guide: components.button.inline-field
/*
`<Button>`

@react-component Button
The `Button` component accepts its text as children (AKA inner HTML), which
means you can also pass in HTML or custom components. This gives you a lot of
flexibility and supports a variety of advanced use cases. The most common use
case would be passing in an SVG icon along with the text.

In addition to the supported props listed, you can also pass in additional
props, which will be passed to the rendered root component. For example,
you could pass in a `target` prop to pass to the rendered anchor element.

@react-example Button.example.jsx

@react-props Button.jsx

Style guide: components.button.react
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Choice from './Choice';
import Dropdown from '../Dropdown/Dropdown';
import { Choice, Dropdown } from '@cmsgov/design-system';
import React from 'react';
import ReactDOM from 'react-dom';

Expand All @@ -11,7 +10,7 @@ const dropdownOptions = [
{ label: 'E', value: 'E' },
{ label: 'F', value: 'F' },
{ label: 'G', value: 'G' },
{ label: 'H', value: 'H' }
{ label: 'H', value: 'H' },
];

const childDropdown = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ChoiceList from './ChoiceList';
import { ChoiceList } from '@cmsgov/design-system';
import React from 'react';
import ReactDOM from 'react-dom';

Expand All @@ -7,7 +7,7 @@ ReactDOM.render(
<ChoiceList
choices={[
{ label: 'Choice 1', value: 'A' },
{ defaultChecked: true, label: 'Choice 2', value: 'B' }
{ defaultChecked: true, label: 'Choice 2', value: 'B' },
]}
className="ds-u-margin-top--0"
label="Radio example"
Expand All @@ -21,8 +21,8 @@ ReactDOM.render(
defaultChecked: true,
label: 'Choice 2',
hint: 'Example hint text',
value: 'B'
}
value: 'B',
},
]}
errorMessage="Example error message"
label="Checkbox example"
Expand All @@ -36,8 +36,8 @@ ReactDOM.render(
{
label: 'Choice 2',
requirementLabel: 'Optional',
value: 'B'
}
value: 'B',
},
]}
label="Choices with requirementLabel"
multiple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ A `ChoiceList` component can be used to render a radio button group, or checkbox

By default the component determines the type of field for you, taking into account accessibility and usability best practices. So, you can pass in an array of `choices` and let it determine what type of field would be best for the user, or alternatively you can manually pass in the `type` prop.

@react-component ChoiceList
@react-example ChoiceList.example.jsx

@react-props ChoiceList.jsx

Style guide: components.choice.choicelist
*/
Expand All @@ -29,7 +31,9 @@ A `Choice` component can be used to render a checkbox or radio button.

Any _undocumented_ props that you pass to this component will be passed to the `input` element, so you can use this to set additional attributes if necessary.

@react-component Choice
@react-example Choice.example.jsx

@react-props Choice.jsx

Style guide: components.choice.react
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment } from 'react';
import DateField from './DateField';
import { DateField } from '@cmsgov/design-system';
import ReactDOM from 'react-dom';

class ControlledDateField extends React.PureComponent {
Expand All @@ -8,7 +8,7 @@ class ControlledDateField extends React.PureComponent {
this.state = {
day: '10',
month: '1',
year: '2000'
year: '2000',
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ Style guide: components.date-field
/*
`<DateField>`

@react-component DateField
@react-example DateField.example.jsx

@react-props DateField.jsx

Style guide: components.date-field.react
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Button from '../Button/Button';
import Dialog from './Dialog';
import { Button, Dialog } from '@cmsgov/design-system';
import React from 'react';
import ReactDOM from 'react-dom';

Expand All @@ -8,7 +7,7 @@ class Example extends React.PureComponent {
super(props);

this.state = {
showModal: false
showModal: false,
};
}

Expand Down Expand Up @@ -42,7 +41,7 @@ class Example extends React.PureComponent {
onClick={() => this.hideModal()}
>
Cancel
</button>
</button>,
]}
>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed accumsan diam vitae metus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Button from '../Button/Button';
import Dialog from '../Dialog/Dialog';
import { Button, Dialog } from '@cmsgov/design-system';
import React from 'react';
import ReactDOM from 'react-dom';

Expand All @@ -8,7 +7,7 @@ class Example extends React.PureComponent {
super(props);

this.state = {
showModal: false
showModal: false,
};
}

Expand Down Expand Up @@ -50,7 +49,7 @@ class Example extends React.PureComponent {
onClick={() => this.hideModal()}
>
Cancel
</Button>
</Button>,
]}
>
You are leaving URL and connecting to a 3rd party site. Please click OK to continue or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ Style guide: components.dialog.size
/*
`<Dialog />`

@react-component Dialog
@react-example Dialog.example.jsx

@react-props Dialog.jsx

Style guide: components.dialog.react
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Style guide: patterns.external-link
/*
`<Dialog />`

@react-component Dialog
@react-example ThirdPartyLink.example.jsx

@react-example ThirdPartyLink
@react-props Dialog.jsx

Style guide: patterns.external-link.react
*/
Expand Down
Loading