-
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
Responsive refactors and addition of helpers #909
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5ca395e
Added basic responsive utility components and classes
9af775a
Displaying `$breakpoints` in docs
06a48cc
Converting to new $euiBreakpoints
13737da
Updated component usages of now deprecated SASS
857a6df
0px not rem
17ec96a
Changelog and added deprecation warning to old mixins
a0fb1e4
Merge branch 'master' into responsive-helpers
cchaos 2d8c321
Addressing PR feedback
198cee5
Adjusting map explanation a bit
cf86a40
Renaming classes using the utility css naming schemed `eui-`
091d76e
Merge branch 'master' into responsive-helpers
cchaos 505503d
Merge branch 'master' into responsive-helpers
cchaos 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
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,46 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiCode, | ||
EuiHideFor, | ||
EuiShowFor, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<div> | ||
<EuiHideFor sizes={['xs']}> | ||
Hiding from <EuiCode>xs</EuiCode> screens only | ||
</EuiHideFor> | ||
<br/> | ||
<EuiHideFor sizes={['xs','s']}> | ||
Hiding from <EuiCode>xs, s</EuiCode> screens | ||
</EuiHideFor> | ||
<br/> | ||
<EuiHideFor sizes={['xs','s','m', 'l']}> | ||
Hiding from <EuiCode>xs, s, m, l</EuiCode> screens | ||
</EuiHideFor> | ||
<br/> | ||
<EuiHideFor sizes={['xl']}> | ||
Hiding from <EuiCode>xl</EuiCode> screens only | ||
</EuiHideFor> | ||
|
||
<br/> | ||
<br/> | ||
|
||
<EuiShowFor sizes={['xs']}> | ||
Showing for <EuiCode>xs</EuiCode> screens only | ||
</EuiShowFor> | ||
<br/> | ||
<EuiShowFor sizes={['xs','s']}> | ||
Showing for <EuiCode>xs, s</EuiCode> screens | ||
</EuiShowFor> | ||
<br/> | ||
<EuiShowFor sizes={['xs','s','m', 'l']}> | ||
Showing for <EuiCode>xs, s, m, l</EuiCode> screens | ||
</EuiShowFor> | ||
<br/> | ||
<EuiShowFor sizes={['xl']}> | ||
Showing for <EuiCode>xl</EuiCode> screen only | ||
</EuiShowFor> | ||
</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,68 @@ | ||
import React from 'react'; | ||
|
||
import { renderToHtml } from '../../services'; | ||
import sizes from '!!sass-vars-to-js-loader!../../../../src/global_styling/variables/_responsive.scss'; | ||
|
||
import { | ||
GuideSectionTypes, | ||
} from '../../components'; | ||
|
||
import { | ||
EuiCode, | ||
EuiShowFor, | ||
EuiHideFor, | ||
EuiCodeBlock, | ||
} from '../../../../src/components'; | ||
|
||
import Responsive from './responsive'; | ||
const responsiveSource = require('!!raw-loader!./responsive'); | ||
const responsiveHtml = renderToHtml(Responsive); | ||
|
||
function renderSizes(size, index) { | ||
let code = `'${size}': ${sizes.euiBreakpoints[size]}px`; | ||
|
||
if (index < sizes.euiBreakpointKeys.length - 1) { | ||
code += ` - ${(sizes.euiBreakpoints[sizes.euiBreakpointKeys[index+1]] - 1)}px`; | ||
} else { | ||
code += ` +`; | ||
} | ||
|
||
return ( | ||
<div key={index}> | ||
{code} | ||
</div> | ||
) | ||
} | ||
|
||
export const ResponsiveExample = { | ||
title: 'Responsive', | ||
sections: [{ | ||
title: 'EuiShowFor and EuiHideFor', | ||
source: [{ | ||
type: GuideSectionTypes.JS, | ||
code: responsiveSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: responsiveHtml, | ||
}], | ||
text: ( | ||
<div> | ||
<p> | ||
Pass an array of named breakpoints to either | ||
the <EuiCode>EuiShowFor</EuiCode> or <EuiCode>EuiHideFor</EuiCode> components | ||
to make them responsive. | ||
</p> | ||
|
||
<p><strong>The sizing correlates with our <EuiCode>$euiBreakpoints</EuiCode> SASS map.</strong></p> | ||
|
||
<EuiCodeBlock language="scss" paddingSize="s"> | ||
{sizes.euiBreakpointKeys.map(function (size, index) { | ||
return renderSizes(size, index); | ||
})} | ||
</EuiCodeBlock> | ||
</div> | ||
), | ||
props: { EuiShowFor, EuiHideFor }, | ||
demo: <Responsive />, | ||
}], | ||
}; |
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
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
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
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 |
---|---|---|
|
@@ -307,3 +307,9 @@ export { | |
EuiIconTip, | ||
EuiToolTip, | ||
} from './tool_tip'; | ||
|
||
export { | ||
EuiHideFor, | ||
EuiShowFor, | ||
} from './responsive'; | ||
|
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
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
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
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.
I would love to see this using our "blue" wrapper boxes to show people the actual sizing. It might help visualize the sizing more quickly. Even possibly listing out the more common scenarios (tablet and below is...
size={xs,s}
...etc.Don't think it needs to be for this PR, and I'm happy to set it up after you merge since you did all the leg work.
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.
Ah, I can do that.
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.
@snide Here's the problem I'm running into with your suggestion. The screen and especially that side of the page never gets large enough to show the full width of anything above size 's'. Unless I'm just not understanding what you mean.
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.
Didn't think about this. One thing we could do is make some page outlines that were fixed positon, or just take these bars and fix them to the bottom of the page (maybe make them thinner).
Always something we can do a bit later. Don't want to hold up your PR on this.
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.
Yeah, ok, I'll push this idea off for later.