Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(styles): load custom fonts #603

Merged
merged 2 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .storybook/manager-head.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,2 @@
<meta name="description" content="SumUp's React UI component library" />
<link rel="icon" type="image/png" href="/images/logo-icon.png" />
<style>
@font-face {
font-family: 'aktiv-grotesk';
font-weight: 400;
src: url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-400.woff2')
format('woff2'),
url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-400.woff')
format('woff'),
url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-400.eot')
format('embedded-opentype');
}

@font-face {
font-family: 'aktiv-grotesk';
font-weight: 700;
src: url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-700.woff2')
format('woff2'),
url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-700.woff')
format('woff'),
url('https://static.sumup.com/fonts/latin-greek-cyrillic/aktiv-grotest-700.eot')
format('embedded-opentype');
}
</style>
22 changes: 0 additions & 22 deletions .storybook/preview-head.html

This file was deleted.

9 changes: 1 addition & 8 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ const SORT_ORDER = {
'Contributing',
'Code of Conduct'
],
Advanced: [
'Static CSS',
'Base Components',
'Theme',
'Grid',
'Icons',
'Fonts'
],
Advanced: ['Static CSS', 'Base Components', 'Theme', 'Grid', 'Icons'],
Typography: ['Heading', 'SubHeading', 'Text'],
Layout: [],
Forms: [],
Expand Down
81 changes: 0 additions & 81 deletions docs/advanced/fonts.story.mdx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

import React from 'react';

import BaseStyles from './BaseStyles';
import { render } from '../../util/test-utils';

import { BaseStyles } from './BaseStyles';
import { createBaseStyles } from './BaseStylesService';

jest.mock('./BaseStylesService', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ import { Global } from '@emotion/core';

import { createBaseStyles } from './BaseStylesService';

const BaseStyles = () => <Global styles={theme => createBaseStyles(theme)} />;

export default BaseStyles;
export const BaseStyles = () => (
<Global styles={theme => createBaseStyles({ theme })} />
);
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { createBaseStyles } from './BaseStylesService';

describe('BaseStylesService', () => {
it('should return the global base styles', () => {
const actual = createBaseStyles(light);
const actual = createBaseStyles({ theme: light });
expect(actual.styles).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,38 @@

import { css } from '@emotion/core';

import { StyleProps } from '../../styles/styled';
import { textMega } from '../../styles/style-helpers';

export const createBaseStyles = theme => css`
const FONTS_BASE_URL = 'https://static.sumup.com/fonts/latin-greek-cyrillic';
connor-baer marked this conversation as resolved.
Show resolved Hide resolved

export const createBaseStyles = ({ theme }: StyleProps) => css`
/**
* Start downloading custom fonts as soon as possible.
*/
@font-face {
font-family: 'aktiv-grotesk';
font-weight: 400;
font-display: swap;
src: url('${FONTS_BASE_URL}/aktiv-grotest-400.woff2') format('woff2'),
url('${FONTS_BASE_URL}/aktiv-grotest-400.woff') format('woff'),
url('${FONTS_BASE_URL}/aktiv-grotest-400.eot') format('embedded-opentype');
}
@font-face {
font-family: 'aktiv-grotesk';
font-weight: 700;
font-display: swap;
src: url('${FONTS_BASE_URL}/aktiv-grotest-700.woff2') format('woff2'),
url('${FONTS_BASE_URL}/aktiv-grotest-700.woff') format('woff'),
url('${FONTS_BASE_URL}/aktiv-grotest-700.eot') format('embedded-opentype');
}

/**
* reset.css
* http://meyerweb.com/eric/tools/css/reset/
* v2.0 | 20110126
* License: none (public domain)
*/

html,
body,
div,
Expand Down Expand Up @@ -134,10 +156,10 @@ export const createBaseStyles = theme => css`
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
blockquote::before,
blockquote::after,
q::before,
q::after {
content: '';
content: none;
}
Expand Down

This file was deleted.

Loading