Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Steps component #202

Merged
merged 6 commits into from
Dec 14, 2017
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# [`master`](https://github.com/elastic/eui/tree/master)

- Added `EuiSteps` component
- Added `EuiHealth` components for status checks [(#158)](https://github.com/elastic/eui/pull/158)
- Cleaned up styling for checkboxes, switches, and radios [(#158)](https://github.com/elastic/eui/pull/158)
- Form `disabled` states are now more consistant [(#158)](https://github.com/elastic/eui/pull/158)
Expand Down Expand Up @@ -51,3 +52,5 @@
# [`0.0.1`](https://github.com/elastic/eui/tree/v0.0.1) Initial Release

- Initial public release


4 changes: 4 additions & 0 deletions src-docs/src/services/routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ import { SideNavExample }
import { SpacerExample }
from '../../views/spacer/spacer_example';

import { StepsExample }
from '../../views/steps/steps_example';

import { TableExample }
from '../../views/table/table_example';

Expand Down Expand Up @@ -200,6 +203,7 @@ const components = [
ProgressExample,
SideNavExample,
SpacerExample,
StepsExample,
TableExample,
TabsExample,
TextExample,
Expand Down
22 changes: 22 additions & 0 deletions src-docs/src/views/steps/heading_element_steps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';

import {
EuiSteps,
} from '../../../../src/components';

const steps = [
{
title: 'inspect me',
children: (<h3>{'Did you notice the step title is inside a Heading 2 element?'}</h3>)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit but I don't think the parens are necessary here.

}
];

export default () => (
<div>
<h1>Heading 1</h1>
<EuiSteps
steps={steps}
headingElement={'h2'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can just be "h2" (no braces necessary).

/>
</div>
);
59 changes: 59 additions & 0 deletions src-docs/src/views/steps/steps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';

import {
EuiCode,
EuiSpacer,
EuiSteps,
EuiText,
} from '../../../../src/components';

const firstSetOfSteps = [
{
title: 'step 1',
children: (<p>{'Do this first'}</p>)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same nit about parens here and elsewhere in the file.

},
{
title: 'step 2',
children: (<p>{'Then this'}</p>)
},
{
title: 'step 3',
children: (<p>{'And finally, do this'}</p>)
},
];

const nextSetOfSteps = [
{
title: 'good step',
children: (<p>{'Do this first'}</p>)
},
{
title: 'better step',
children: (<p>{'Then this'}</p>)
},
{
title: 'best step',
children: (<p>{'And finally, do this'}</p>)
},
];

export default () => (
<div>
<EuiSteps
steps={firstSetOfSteps}
/>

<EuiText>
<EuiSpacer size="m"/>
<p>
Set <EuiCode>firstStepNumber</EuiCode> to continue step numbering after any type of break in the content
</p>
<EuiSpacer size="m"/>
</EuiText>

<EuiSteps
firstStepNumber={firstSetOfSteps.length}
steps={nextSetOfSteps}
/>
</div>
);
51 changes: 51 additions & 0 deletions src-docs/src/views/steps/steps_example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React from 'react';

import { renderToHtml } from '../../services';

import {
GuideSectionTypes,
} from '../../components';

import Steps from './steps';
const stepsSource = require('!!raw-loader!./steps');
const stepsHtml = renderToHtml(Steps);

import HeadingElementSteps from './heading_element_steps';
const headingElementStepsSource = require('!!raw-loader!./heading_element_steps');
const headingElementStepsHtml = renderToHtml(HeadingElementSteps);

export const StepsExample = {
title: 'Steps',
sections: [{
title: 'Steps',
source: [{
type: GuideSectionTypes.JS,
code: stepsSource,
}, {
type: GuideSectionTypes.HTML,
code: stepsHtml,
}],
text: (
<p>
Numbered steps
</p>
),
demo: <Steps />,
},
{
title: 'Heading Element Steps',
source: [{
type: GuideSectionTypes.JS,
code: headingElementStepsSource,
}, {
type: GuideSectionTypes.HTML,
code: headingElementStepsHtml,
}],
text: (
<p>
something something better accessibility
</p>
),
demo: <HeadingElementSteps />,
}],
};
4 changes: 4 additions & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ export {
EuiSpacer,
} from './spacer';

export {
EuiSteps,
} from './steps';

export {
EuiTable,
EuiTableBody,
Expand Down
1 change: 1 addition & 0 deletions src/components/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
@import 'progress/index';
@import 'side_nav/index';
@import 'spacer/index';
@import 'steps/index';
@import 'table/index';
@import 'tabs/index';
@import 'title/index';
Expand Down
29 changes: 29 additions & 0 deletions src/components/steps/__snapshots__/step.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`EuiStep is rendered 1`] = `
<div
aria-label="aria-label"
class="euiStep testClass1 testClass2"
data-test-subj="test subject string"
>
<div>
<div
class="euiStepNumber"
>
1
</div>
<h3
class="euiTitle euiStepTitle"
>
First step
</h3>
</div>
<div
class="euiStepContent"
>
<p>
Do this
</p>
</div>
</div>
`;
Loading