Skip to content

Commit 06d7033

Browse files
authored
Merge pull request #25 from scorebreaker/add-sass
style: add sass support and general setup
2 parents 2ec8a43 + 9a46be7 commit 06d7033

File tree

8 files changed

+611
-21
lines changed

8 files changed

+611
-21
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"bignumber.js": "^9.0.1",
2222
"mobx": "^6.0.4",
2323
"mobx-react": "^7.0.5",
24+
"node-sass": "4.14.1",
2425
"qrcode.react": "^1.0.0",
2526
"react": "^16.13.1",
2627
"react-dom": "^16.13.1",

src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import ReactDOM from "react-dom";
3+
import "./styles/styles.scss";
34
import App from "./App";
45

56
ReactDOM.render(

src/styles/abstracts/_mixins.scss

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
@mixin clearfix {
2+
&::after {
3+
content: "";
4+
display: table;
5+
clear: both;
6+
}
7+
}
8+
9+
@mixin absCenter {
10+
position: absolute;
11+
top: 50%;
12+
left: 50%;
13+
transform: translate(-50%, -50%);
14+
}
15+
16+
@mixin respond($breakpoint) {
17+
@if $breakpoint == small-phone {
18+
@media only screen and (max-width: 22.8em) {
19+
@content;
20+
} //max 365px
21+
}
22+
23+
@if $breakpoint == phone {
24+
@media only screen and (max-width: 37.5em) {
25+
@content;
26+
} //max 600px
27+
}
28+
29+
@if $breakpoint == tab-port {
30+
@media only screen and (max-width: 56.25em) {
31+
@content;
32+
} // max 900px
33+
}
34+
35+
@if $breakpoint == tab-land {
36+
@media only screen and (max-width: 75em) {
37+
@content;
38+
} // max 1200px
39+
}
40+
41+
@if $breakpoint == medium-desktop {
42+
@media only screen and (max-width: 93.75em) {
43+
@content;
44+
} // max 1500px
45+
}
46+
47+
@if $breakpoint == desktop {
48+
@media only screen and (max-width: 112.5em) {
49+
@content;
50+
} //max 1800px
51+
}
52+
53+
@if $breakpoint == big-desktop {
54+
@media only screen and (min-width: 125em) {
55+
@content;
56+
} //min width 2000px
57+
}
58+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Grid
2+
$grid-width: 114rem;
3+
$gutter-vertical: 0rem;
4+
$gutter-vertical-small: 0rem;
5+
$gutter-horizontal: 0rem;

src/styles/base/_base.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*,
2+
*::after,
3+
*::before {
4+
margin: 0;
5+
padding: 0;
6+
box-sizing: inherit;
7+
}
8+
9+
body {
10+
box-sizing: border-box;
11+
}

src/styles/layout/_grid.scss

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
.row {
2+
max-width: $grid-width;
3+
margin: 0 auto;
4+
5+
&:not(:last-child) {
6+
margin-bottom: $gutter-vertical;
7+
8+
@include respond(tab-port) {
9+
margin-bottom: $gutter-vertical-small;
10+
}
11+
}
12+
13+
@include respond(tab-port) {
14+
max-width: 95%;
15+
}
16+
17+
@include respond(phone) {
18+
max-width: 100%;
19+
padding: 0;
20+
}
21+
22+
@include clearfix;
23+
24+
[class^="col-"] {
25+
float: left;
26+
27+
&:not(:last-child) {
28+
margin-right: $gutter-horizontal;
29+
30+
@include respond(tab-port) {
31+
margin-right: 0;
32+
margin-bottom: $gutter-vertical-small;
33+
}
34+
}
35+
36+
@include respond(tab-port) {
37+
width: 100% !important;
38+
}
39+
}
40+
41+
.col-1-of-2 {
42+
width: calc((100% - #{$gutter-horizontal}) / 2);
43+
}
44+
45+
.col-1-of-3 {
46+
width: calc((100% - 2 * #{$gutter-horizontal}) / 3);
47+
}
48+
49+
.col-2-of-3 {
50+
width: calc(
51+
2 * ((100% - 2 * #{$gutter-horizontal}) / 3) + #{$gutter-horizontal}
52+
);
53+
}
54+
55+
.col-1-of-4 {
56+
width: calc((100% - 3 * #{$gutter-horizontal}) / 4);
57+
}
58+
59+
.col-2-of-4 {
60+
width: calc(
61+
2 * ((100% - 3 * #{$gutter-horizontal}) / 4) + #{$gutter-horizontal}
62+
);
63+
}
64+
65+
.col-3-of-4 {
66+
width: calc(
67+
3 * ((100% - 3 * #{$gutter-horizontal}) / 4) + 2 * #{$gutter-horizontal}
68+
);
69+
}
70+
}

src/styles/styles.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@import "./abstracts/mixins";
2+
@import "./abstracts/variables";
3+
4+
@import "./base/base";
5+
6+
@import "./layout/grid";

0 commit comments

Comments
 (0)