Skip to content

Instantly share code, notes, and snippets.

@SaraVieira
Created February 8, 2019 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SaraVieira/18f33e1728b0a25661cc0726acb7eb29 to your computer and use it in GitHub Desktop.
Save SaraVieira/18f33e1728b0a25661cc0726acb7eb29 to your computer and use it in GitHub Desktop.
SUNIL WAT????
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
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