Skip to content

Commit 952338a

Browse files
fkDSchau
authored andcommitted
feat(www): Spring cleaning episode 2 (#12464)
Picking up where #12264 left off: - `presets.scale` _almost_ everywhere - less `boxShadow: none` and `:hover { background: "none" }` overrides for links — we don’t need to overwrite this style anymore - add `presets.letterSpacings` and use them - add `colors.white` and use it - import `radii` directly instead of doing `presets.radii[x]` - rename `presets.animation` to `presets.transition` - import `transition` directly instead of doing `presets.transition[x]` - add `presets.shadows.cardActive` - more `presets.space` refactoring - remove Futura PT `specimen_files`, demo HTML, and „How to use web fonts“ - first improvements to the „Starters“ search input styles - simplify things here and there 😉
1 parent 8490734 commit 952338a

File tree

87 files changed

+649
-4700
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+649
-4700
lines changed

www/src/components/banner.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ const Content = styled(`div`)`
3535
white-space: nowrap;
3636
3737
a {
38-
color: #fff;
39-
border-bottom: 1px solid #fff;
38+
color: ${colors.white};
39+
border-bottom: 1px solid ${colors.white};
4040
}
4141
4242
a:hover {
43-
color: #fff;
44-
border-bottom-color: #ffffffa0;
43+
color: ${colors.white};
44+
border-bottom-color: ${colors.white}a0;
4545
}
4646
`
4747

www/src/components/blog-post-preview-item.js

+6-25
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { Link, graphql } from "gatsby"
33
import Img from "gatsby-image"
44

55
import { rhythm, options } from "../utils/typography"
6-
import presets, { colors, space } from "../utils/presets"
6+
import { colors, space, radii } from "../utils/presets"
77

88
const BlogPostPreviewItem = ({ post, className }) => (
99
<article className={className} css={{ position: `relative` }}>
1010
<Link to={post.fields.slug} css={{ "&&": { color: colors.gray.copy } }}>
1111
<h2 css={{ marginTop: 0 }}>{post.frontmatter.title}</h2>
12-
<p css={{ fontWeight: `normal` }}>
12+
<p>
1313
{post.frontmatter.excerpt ? post.frontmatter.excerpt : post.excerpt}
1414
</p>
1515
</Link>
@@ -24,21 +24,14 @@ const BlogPostPreviewItem = ({ post, className }) => (
2424
css={{
2525
position: `relative`,
2626
zIndex: 1,
27-
"&&": {
28-
boxShadow: `none`,
29-
borderBottom: `0`,
30-
fontWeight: `normal`,
31-
":hover": {
32-
background: `transparent`,
33-
},
34-
},
27+
"&&": { borderBottom: `0` },
3528
}}
3629
>
3730
<Img
3831
alt=""
3932
fixed={post.frontmatter.author.avatar.childImageSharp.fixed}
4033
css={{
41-
borderRadius: presets.radii[6],
34+
borderRadius: radii[6],
4235
display: `inline-block`,
4336
marginRight: rhythm(space[3]),
4437
marginBottom: 0,
@@ -61,13 +54,7 @@ const BlogPostPreviewItem = ({ post, className }) => (
6154
css={{
6255
position: `relative`,
6356
zIndex: 1,
64-
"&&": {
65-
color: colors.gatsby,
66-
fontWeight: `normal`,
67-
":hover": {
68-
background: colors.ui.bright,
69-
},
70-
},
57+
"&&": { color: colors.gatsby },
7158
}}
7259
>
7360
{post.frontmatter.author.id}
@@ -91,13 +78,7 @@ const BlogPostPreviewItem = ({ post, className }) => (
9178
textIndent: `-100%`,
9279
whiteSpace: `nowrap`,
9380
zIndex: 0,
94-
"&&": {
95-
border: 0,
96-
boxShadow: `none`,
97-
"&:hover": {
98-
background: `none`,
99-
},
100-
},
81+
"&&": { border: 0 },
10182
}}
10283
>
10384
Read more

www/src/components/card.js

+5-15
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,15 @@ const Card = ({ children }) => (
1212
flex: `0 0 auto`,
1313
maxWidth: `50%`,
1414
boxShadow: `0 1px 0 0 ${colors.ui.light}`,
15-
"&:nth-of-type(5),&:nth-of-type(6)": {
16-
boxShadow: `none`,
17-
},
18-
"&:nth-of-type(2n)": {
19-
borderLeft: `1px solid ${colors.ui.light}`,
20-
},
15+
"&:nth-of-type(5), &:nth-of-type(6)": { boxShadow: `none` },
16+
"&:nth-of-type(2n)": { borderLeft: `1px solid ${colors.ui.light}` },
2117
},
2218
[presets.Xl]: {
2319
flex: `0 0 auto`,
2420
maxWidth: `33.33333333%`,
2521
borderLeft: `1px solid ${colors.ui.light}`,
26-
"&:nth-of-type(4)": {
27-
boxShadow: `none`,
28-
},
29-
"&:nth-of-type(3n+1)": {
30-
borderLeft: 0,
31-
},
22+
"&:nth-of-type(4)": { boxShadow: `none` },
23+
"&:nth-of-type(3n+1)": { borderLeft: 0 },
3224
},
3325
}}
3426
>
@@ -37,9 +29,7 @@ const Card = ({ children }) => (
3729
padding: rhythm(space[6]),
3830
paddingBottom: 0,
3931
transform: `translateZ(0)`,
40-
[presets.Sm]: {
41-
padding: rhythm(space[8]),
42-
},
32+
[presets.Sm]: { padding: rhythm(space[8]) },
4333
}}
4434
>
4535
{children}

www/src/components/chart.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react"
22
import ReactHighcharts from "react-highcharts"
3-
import presets from "../utils/presets"
3+
import { radii } from "../utils/presets"
44

55
const dateToUTC = date => {
66
const d = String(date)
@@ -30,7 +30,7 @@ const highchartsOptions = {
3030
},
3131
tooltip: {
3232
backgroundColor: `#FFFFFF`,
33-
borderRadius: presets.radii[1],
33+
borderRadius: radii[1],
3434
},
3535
credits: {
3636
enabled: false,

www/src/components/container.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
import React from "react"
22

3-
import presets from "../utils/presets"
4-
import { rhythm, options } from "../utils/typography"
3+
import presets, { space } from "../utils/presets"
4+
import { rhythm } from "../utils/typography"
55

66
const Container = ({ children, hasSideBar = true, overrideCSS }) => (
77
<div
88
css={{
99
maxWidth: hasSideBar ? rhythm(28) : rhythm(36),
1010
margin: `0 auto`,
11-
padding: `${rhythm(options.blockMarginBottom)} ${rhythm(
12-
options.blockMarginBottom
13-
)}`,
11+
padding: rhythm(space[6]),
1412
position: `relative`,
1513
[presets.Lg]: {
16-
paddingTop: rhythm(options.blockMarginBottom * 2),
17-
paddingBottom: rhythm(options.blockMarginBottom * 2),
14+
paddingTop: rhythm(space[9]),
15+
paddingBottom: rhythm(space[9]),
1816
},
1917
...overrideCSS,
2018
}}

www/src/components/diagram.js

+21-28
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { keyframes } from "@emotion/core"
33
import { Link, StaticQuery, graphql } from "gatsby"
44

55
import { rhythm, options } from "../utils/typography"
6-
import presets, { colors, space } from "../utils/presets"
6+
import presets, { colors, space, radii } from "../utils/presets"
77
import logo from "../monogram.svg"
88
import { GraphQLIcon, ReactJSIcon } from "../assets/logos"
99
import FuturaParagraph from "../components/futura-paragraph"
@@ -24,9 +24,7 @@ const stripeBg = {
2424
animation: `${stripeAnimation} 14s linear infinite`,
2525
}
2626
const lineAnimation = keyframes({
27-
to: {
28-
strokeDashoffset: 10,
29-
},
27+
to: { strokeDashoffset: 10 },
3028
})
3129

3230
const Segment = ({ className, children }) => (
@@ -49,13 +47,13 @@ const SegmentTitle = ({ children }) => (
4947
display: `inline`,
5048
background: colors.accent,
5149
color: colors.gray.copy,
52-
borderRadius: presets.radii[1],
50+
borderRadius: radii[1],
5351
margin: `0 auto`,
5452
position: `relative`,
55-
bottom: `-.5rem`,
56-
padding: `.35rem .6rem`,
53+
bottom: `-${rhythm(space[2])}`,
54+
padding: `${rhythm(space[2])} ${rhythm(space[3])}`,
5755
fontWeight: `normal`,
58-
letterSpacing: `.5px`,
56+
letterSpacing: presets.letterSpacings.tracked,
5957
fontSize: presets.scale[1],
6058
lineHeight: presets.lineHeights.solid,
6159
textTransform: `uppercase`,
@@ -87,16 +85,16 @@ const VerticalLine = () => (
8785
)
8886

8987
const box = {
90-
background: `#fff`,
88+
background: colors.white,
9189
border: `1px solid ${colors.ui.light}`,
92-
borderRadius: presets.radii[2],
90+
borderRadius: radii[2],
9391
padding: `${rhythm(space[5])} ${rhythm(space[7])} 0`,
9492
}
9593

9694
const borderAndBoxShadow = {
97-
background: `#fff`,
95+
background: colors.white,
9896
border: `1px solid ${colors.ui.light}`,
99-
borderRadius: presets.radii[1],
97+
borderRadius: radii[1],
10098
boxShadow: presets.shadows.card,
10199
transform: `translateZ(0)`,
102100
width: `100%`,
@@ -173,9 +171,7 @@ const ItemDescription = ({ children }) => (
173171
)
174172

175173
const ItemDescriptionLink = ({ to, children }) => (
176-
<Link css={{ "&&": { fontWeight: `normal` } }} to={to}>
177-
{children}
178-
</Link>
174+
<Link to={to}>{children}</Link>
179175
)
180176

181177
const Gatsby = () => (
@@ -196,31 +192,26 @@ const Gatsby = () => (
196192
src={logo}
197193
css={{
198194
display: `inline-block`,
199-
height: rhythm(1.75),
200-
width: rhythm(1.75),
201-
[presets.Lg]: {
202-
width: rhythm(2.25),
203-
height: rhythm(2.25),
204-
},
195+
height: rhythm(space[8]),
205196
margin: 0,
206197
verticalAlign: `middle`,
198+
width: `auto`,
199+
[presets.Lg]: {
200+
height: rhythm(space[9]),
201+
},
207202
}}
208203
alt="Gatsby"
209204
/>
210205
<ItemDescription>
211206
<small
212207
css={{
213-
marginTop: `.25rem`,
208+
marginTop: rhythm(space[1]),
214209
display: `block`,
215210
}}
216211
>
217212
powered by
218213
</small>
219-
<span
220-
css={{
221-
color: colors.gatsby,
222-
}}
223-
>
214+
<span css={{ color: colors.gatsby }}>
224215
<TechWithIcon icon={GraphQLIcon}>GraphQL</TechWithIcon>
225216
</span>
226217
</ItemDescription>
@@ -262,7 +253,9 @@ const Diagram = () => (
262253
>
263254
How Gatsby works
264255
</h1>
265-
<div css={{ maxWidth: rhythm(20), margin: `0 auto ${rhythm(2)}` }}>
256+
<div
257+
css={{ maxWidth: rhythm(20), margin: `0 auto ${rhythm(space[9])}` }}
258+
>
266259
<FuturaParagraph>
267260
Pull data from <em>anywhere</em>
268261
</FuturaParagraph>

www/src/components/ecosystem/ecosystem-board.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import styled from "@emotion/styled"
44

55
import EcosystemSection from "./ecosystem-section"
66

7-
import presets from "../../utils/presets"
7+
import presets, { space } from "../../utils/presets"
8+
import { rhythm } from "../../utils/typography"
89
import {
910
setupScrollersObserver,
1011
unobserveScrollers,
@@ -20,7 +21,7 @@ const EcosystemBoardRoot = styled(`div`)`
2021
height: calc(
2122
100vh - (${presets.bannerHeight} + ${presets.headerHeight} + 1px)
2223
);
23-
padding: 2rem 1rem 1rem;
24+
padding: ${rhythm(space[7])} ${rhythm(space[4])} ${rhythm(space[4])};
2425
}
2526
`
2627

www/src/components/ecosystem/ecosystem-featured-item.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import StarIcon from "react-icons/lib/md/star"
1010
import ArrowDownwardIcon from "react-icons/lib/md/arrow-downward"
1111

1212
import { rhythm, options } from "../../utils/typography"
13-
import presets, { colors, space } from "../../utils/presets"
13+
import presets, { colors, space, transition, radii } from "../../utils/presets"
1414

1515
const MAX_DESCRIPTION_LENGTH = 100
1616

1717
const EcosystemFeaturedItemRoot = styled(HorizontalScrollerItem)`
18-
margin-right: ${rhythm(options.blockMarginBottom)};
18+
margin-right: ${rhythm(space[6])};
1919
2020
${presets.Md} {
2121
border-bottom: 1px solid ${colors.gray.superLight};
@@ -27,8 +27,8 @@ const EcosystemFeaturedItemRoot = styled(HorizontalScrollerItem)`
2727
`
2828

2929
export const BlockLink = styled(Link)`
30-
background: #fff;
31-
border-radius: ${presets.radii[2]}px;
30+
background: ${colors.white};
31+
border-radius: ${radii[2]}px;
3232
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
3333
display: flex;
3434
flex-direction: column;
@@ -38,8 +38,7 @@ export const BlockLink = styled(Link)`
3838
${presets.Md} {
3939
border-radius: 0;
4040
box-shadow: none;
41-
transition: all ${presets.animation.speedDefault}
42-
${presets.animation.curveDefault};
41+
transition: all ${transition.speed.default} ${transition.curve.default};
4342
}
4443
4544
${presets.Lg} {
@@ -81,13 +80,13 @@ const Digest = styled(`div`)`
8180
flex-grow: 1;
8281
font-family: ${options.systemFontFamily.join(`,`)};
8382
justify-content: space-between;
84-
padding: ${rhythm(0.5)} 0 0;
83+
padding: ${rhythm(space[3])} 0 0;
8584
`
8685

8786
const Thumbnail = styled(`div`)`
8887
height: 64px;
8988
padding-right: ${rhythm(space[4])};
90-
margin-top: ${rhythm(1 / 12)};
89+
margin-top: ${rhythm(space[1])};
9190
9291
img {
9392
border: 1px solid ${colors.gray.superLight};

www/src/components/ecosystem/ecosystem-featured-items.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ import {
77
HorizontalScrollerContent,
88
} from "../shared/horizontal-scroller"
99

10-
import presets, { colors } from "../../utils/presets"
11-
import { rhythm, options } from "../../utils/typography"
10+
import presets, { colors, space } from "../../utils/presets"
11+
import { rhythm } from "../../utils/typography"
1212
import { scrollbarStyles } from "../../utils/styles"
1313
import { SCROLLER_CLASSNAME } from "../../utils/scrollers-observer"
1414

1515
const EcosystemFeaturedItemsRoot = styled(HorizontalScroller)`
16-
margin: ${rhythm(0.1)} -${rhythm(options.blockMarginBottom)};
16+
margin: 0 -${rhythm(space[6])};
1717
1818
${presets.Md} {
1919
border-top: 1px solid ${colors.gray.superLight};
20-
margin-top: ${rhythm(0.4)};
20+
margin-top: ${rhythm(space[3])};
2121
margin-bottom: 0;
2222
overflow-y: scroll;
2323
overflow-x: hidden;
@@ -29,12 +29,12 @@ export const ListBase = styled(`ul`)`
2929
display: inline-flex;
3030
list-style: none;
3131
margin: 0;
32-
padding: 0 calc(${rhythm(options.blockMarginBottom)} - 5px) 4px;
32+
padding: 0 calc(${rhythm(space[6])} - 5px) 4px;
3333
`
3434

3535
const List = styled(HorizontalScrollerContent)`
36-
padding-left: ${rhythm(options.blockMarginBottom)};
37-
padding-right: ${rhythm(options.blockMarginBottom)};
36+
padding-left: ${rhythm(space[6])};
37+
padding-right: ${rhythm(space[6])};
3838
3939
${presets.Md} {
4040
flex-direction: column;

0 commit comments

Comments
 (0)