-
Notifications
You must be signed in to change notification settings - Fork 841
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
add Steps component #202
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3f36a32
add Steps component
nreese 1d7124e
rename offset to firstStepNumber, add EuiStep jest test, pass classNa…
nreese c150655
rename euiStep to euiStepContent, put euiStep class on root element
nreese 38fba87
add headingElement prop
nreese cf81499
add heading element example to src-docs
nreese be7c3cd
more cleanup
nreese File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>) | ||
} | ||
]; | ||
|
||
export default () => ( | ||
<div> | ||
<h1>Heading 1</h1> | ||
<EuiSteps | ||
steps={steps} | ||
headingElement={'h2'} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can just be |
||
/> | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 />, | ||
}], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.