-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Responsive refactors and addition of helpers (#909)
- Loading branch information
Showing
42 changed files
with
506 additions
and
80 deletions.
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,71 @@ | ||
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 += ` (to ${(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> | ||
The sizing correlates with our <EuiCode>$euiBreakpoints</EuiCode> SASS map. The named | ||
breakpoint starts at the pixel value provided and ends before the next one. | ||
</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.