Skip to content

Instantly share code, notes, and snippets.

@goellner
Created January 6, 2019 00:15
Show Gist options
  • Save goellner/4ad20ade4fbf60ce96da6c2ff4ea955e to your computer and use it in GitHub Desktop.
Save goellner/4ad20ade4fbf60ce96da6c2ff4ea955e to your computer and use it in GitHub Desktop.
Gridle Debug Toggle
// DEBUG
.grid {
position: fixed;
width: 100%;
top: 0;
left: 0;
pointer-events: none;
z-index: 100000;
display: block;
user-select: none;
&.hidden {
display: none;
}
&__toggle {
width: 50px;
height: 50px;
position: fixed;
top: 50%;
margin-top: -25px;
left: 20px;
background-color: gold;
border-radius: 50%;
transition: all 0.2s ease;
&:hover {
background-color: lighten(gold, 5%);
}
&:after {
content: 'Grid';
text-align: center;
position: absolute;
top: 0;
left: 0;
width: 50px;
height: 50px;
line-height: 50px;
vertical-align: middle;
color: rgba(black, 0.5);
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
}
.gr-1 {
height: 100vh;
text-align: center;
position: relative;
span {
display: inline-block;
color: rgba(white, 0.15);
padding-top: 10px;
font-size: 12px;
font-family: "Arial", "Helvetica", sans-serif;
}
&:before {
content: '';
position: absolute;
top: 0;
left: map-get($settings, 'gutter-left');
right: map-get($settings, 'gutter-right');
border-left: 1px solid rgba(black, 0.05);
border-right: 1px solid rgba(black, 0.05);
height: 100vh;
}
&:nth-child(even) {
background-color: rgba(#b63737, 0.05);
}
&:nth-child(odd) {
background-color: rgba(#b63737, 0.1);
}
}
}
import React, {Fragment} from "react";
export default class GridDebug extends React.Component {
constructor(props) {
super(props);
this.state = {
gridVisible: false
};
}
componentDidMount() {
document.addEventListener("keydown", e => {
if (e.keyCode === 71 && e.shiftKey) {
this.setState({
gridVisible: !this.state.gridVisible,
});
}
});
}
handleClick = () => {
this.setState({
gridVisible: !this.state.gridVisible
});
}
render() {
return (
<Fragment>
{/* <div className="grid__toggle" onClick={this.handleClick}></div> */}
<section className={`grid ${this.state.gridVisible ? "" : "hidden"}`}>
<div className="container">
<div className="row">
<div className="gr-1"><span>1</span></div>
<div className="gr-1"><span>2</span></div>
<div className="gr-1"><span>3</span></div>
<div className="gr-1"><span>4</span></div>
<div className="gr-1"><span>5</span></div>
<div className="gr-1"><span>6</span></div>
<div className="gr-1"><span>7</span></div>
<div className="gr-1"><span>8</span></div>
<div className="gr-1"><span>9</span></div>
<div className="gr-1"><span>10</span></div>
<div className="gr-1"><span>11</span></div>
<div className="gr-1"><span>12</span></div>
<div className="gr-1"><span>13</span></div>
<div className="gr-1"><span>14</span></div>
<div className="gr-1"><span>15</span></div>
<div className="gr-1"><span>16</span></div>
<div className="gr-1"><span>17</span></div>
<div className="gr-1"><span>18</span></div>
<div className="gr-1"><span>19</span></div>
<div className="gr-1"><span>20</span></div>
<div className="gr-1"><span>21</span></div>
<div className="gr-1"><span>22</span></div>
<div className="gr-1"><span>23</span></div>
<div className="gr-1"><span>24</span></div>
</div>
</div>
</section>
</Fragment>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment