Skip to content

Commit

Permalink
Added HkGrotesk font
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusps committed Apr 17, 2019
1 parent b5f0b65 commit 98bc263
Show file tree
Hide file tree
Showing 16 changed files with 97 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"babel-loader": "^8.0.5",
"babel-plugin-styled-components": "^1.10.0",
"codecov": "^3.3.0",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"jest": "^24.7.1",
"jest-styled-components": "^6.3.1",
Expand Down
77 changes: 77 additions & 0 deletions src/components/QuarksTheme/GobalStyles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { createGlobalStyle } from 'styled-components'

/** HKGrotesk */
import FontLight from './font/light.woff'
import FontLight2 from './font/light.woff2'
import FontRegular from './font/regular.woff'
import FontRegular2 from './font/regular.woff2'
import FontMedium from './font/medium.woff'
import FontMedium2 from './font/medium.woff2'
import FontSemibold from './font/semiBold.woff'
import FontSemibold2 from './font/semiBold.woff2'
import FontBold from './font/bold.woff'
import FontBold2 from './font/bold.woff2'

const GlobalStyles = createGlobalStyle`
@font-face {
font-family: HkGrotesk;
src: url(${FontLight}) format('woff'),
url(${FontLight2}) format('woff2');
font-weight: 300;
}
@font-face {
font-family: HkGrotesk;
src: url(${FontRegular}) format('woff'),
url(${FontRegular2}) format('woff2');
font-weight: 400;
}
@font-face {
font-family: HkGrotesk;
src: url(${FontMedium}) format('woff'),
url(${FontMedium2}) format('woff2');
font-weight: 500;
}
@font-face {
font-family: HkGrotesk;
src: url(${FontSemibold}) format('woff'),
url(${FontSemibold2}) format('woff2');
font-weight: 600;
}
@font-face {
font-family: HkGrotesk;
src: url(${FontBold}) format('woff'),
url(${FontBold2}) format('woff2');
font-weight: 800;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
html {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: HkGrotesk, sans-serif;
overflow-x: hidden;
text-rendering: optimizeLegibility;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
font-variant-ligatures: no-common-ligatures;
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p, button, input {
font-family: HkGrotesk, sans-serif;
}
`
export default GlobalStyles
Binary file added src/components/QuarksTheme/font/bold.woff
Binary file not shown.
Binary file added src/components/QuarksTheme/font/bold.woff2
Binary file not shown.
Binary file added src/components/QuarksTheme/font/light.woff
Binary file not shown.
Binary file added src/components/QuarksTheme/font/light.woff2
Binary file not shown.
Binary file added src/components/QuarksTheme/font/medium.woff
Binary file not shown.
Binary file added src/components/QuarksTheme/font/medium.woff2
Binary file not shown.
Binary file added src/components/QuarksTheme/font/regular.woff
Binary file not shown.
Binary file added src/components/QuarksTheme/font/regular.woff2
Binary file not shown.
Binary file added src/components/QuarksTheme/font/semiBold.woff
Binary file not shown.
Binary file added src/components/QuarksTheme/font/semiBold.woff2
Binary file not shown.
6 changes: 5 additions & 1 deletion src/components/QuarksTheme/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { FunctionComponent } from 'react'
import { ThemeProvider } from 'styled-components'

import GlobalStyles from './GobalStyles'
import { light } from './stockThemes'

interface Props {
Expand All @@ -13,7 +14,10 @@ interface Props {
const QuarksTheme: FunctionComponent<Props> = ({ theme, children }) => {
return (
<ThemeProvider theme={theme}>
<>{children}</>
<>
<GlobalStyles />
{children}
</>
</ThemeProvider>
)
}
Expand Down
2 changes: 2 additions & 0 deletions src/global/fonts.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare module '*.woff'
declare module '*.woff2'
4 changes: 4 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ module.exports = {
use: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.(eot|svg|ttf|woff|woff2|otf)$/,
loader: 'file-loader',
},
],
},
plugins: [
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3277,6 +3277,14 @@ figures@^2.0.0:
dependencies:
escape-string-regexp "^1.0.5"

file-loader@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-3.0.1.tgz#f8e0ba0b599918b51adfe45d66d1e771ad560faa"
integrity sha512-4sNIOXgtH/9WZq4NvlfU3Opn5ynUsqBwSLyM+I7UOwdGigTBYfVVQEwe/msZNX/j4pCJTIM14Fsw66Svo1oVrw==
dependencies:
loader-utils "^1.0.2"
schema-utils "^1.0.0"

fileset@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0"
Expand Down

0 comments on commit 98bc263

Please sign in to comment.