Created
February 8, 2019 11:48
-
-
Save SaraVieira/18f33e1728b0a25661cc0726acb7eb29 to your computer and use it in GitHub Desktop.
SUNIL WAT????
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
import React, { useState, useEffect } from 'react' | |
import breakpoint from 'styled-components-breakpoint' | |
import { Col, Row, Grid } from '../grid' | |
const GridDebugger = () => { | |
const [showGrid, toggleShowGrid] = useState(false) | |
const handleKey = ev => { | |
if (ev.key === 'g' && ev.ctrlKey) { | |
console.log('lol') | |
toggleShowGrid(!showGrid) | |
} | |
} | |
useEffect( | |
() => { | |
window.addEventListener('keyup', handleKey) | |
return () => window.removeEventListener('keyup', handleKey) | |
}, | |
[] | |
) | |
return showGrid ? ( | |
<Container> | |
<Row> | |
{Array.from(new Array(12)).map((el, idx) => ( | |
<Column key={idx} width={[1, 1, 1, 1, 1 / 12]} block={false}> | |
<ColumnContent /> | |
</Column> | |
))} | |
</Row> | |
</Container> | |
) : null | |
} | |
export default GridDebugger |
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
import React, { useState, useEffect } from 'react' | |
import breakpoint from 'styled-components-breakpoint' | |
import { Col, Row, Grid } from '../grid' | |
const GridDebugger = () => { | |
const [showGrid, toggleShowGrid] = useState(false) | |
const handleKey = ev => { | |
if (ev.key === 'g' && ev.ctrlKey) { | |
console.log('lol') | |
toggleShowGrid(!showGrid) | |
} | |
} | |
useEffect( | |
() => { | |
window.addEventListener('keyup', handleKey) | |
return () => window.removeEventListener('keyup', handleKey) | |
}, | |
[showGrid] | |
) | |
return showGrid ? ( | |
<Container> | |
<Row> | |
{Array.from(new Array(12)).map((el, idx) => ( | |
<Column key={idx} width={[1, 1, 1, 1, 1 / 12]} block={false}> | |
<ColumnContent /> | |
</Column> | |
))} | |
</Row> | |
</Container> | |
) : null | |
} | |
export default GridDebugger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment