Skip to content

Commit

Permalink
feat(react-ui): πŸš€ updated to v1.2.0-beta.1 (#75)
Browse files Browse the repository at this point in the history
* feat(react-ui): πŸš€  updated to v1.2.0-beta.1

* fix(font-face-observer): πŸ›  font face observer was never actually used

specificity issues when using the body.font-loaded send help πŸ€·β€β™‚οΈ

* refactor(font-display): πŸ”  added font-display: swap, removed ffobserver

* fix(old-state): πŸ›  css prop allows for pseudo elements as well
  • Loading branch information
mitchelvanbever authored Mar 10, 2021
1 parent 1b590be commit aff556e
Show file tree
Hide file tree
Showing 21 changed files with 1,702 additions and 1,650 deletions.
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"presets": ["next/babel"],
"plugins": [
["styled-components", {"ssr": true}],
"babel-plugin-transform-typescript-metadata",
["@babel/plugin-proposal-decorators", { "legacy": true }],
"babel-plugin-parameter-decorator"
"babel-plugin-parameter-decorator",
["styled-components", {"ssr": true}]
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"**/yarn-error.log": true,
"**/next-env.d.ts": true,
"**/yarn.lock": true,
".babelrc": true,
// ".babelrc": true,
".cz-config.js": true,
".eslintignore": true,
".gitignore": true,
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,33 @@
},
"dependencies": {
"@next/bundle-analyzer": "^10.0.6",
"@reach/alert": "0.12.1",
"@rebass/forms": "4.0.6",
"@reach/alert": "0.13.2",
"@reach/checkbox": "0.13.2",
"@reach/dialog": "0.13.2",
"@sentry/browser": "6.0.0",
"@sentry/integrations": "6.0.0",
"@sentry/node": "6.0.0",
"@storyofams/next-api-decorators": "1.2.0",
"@storyofams/react-helpers": "0.3.6",
"@storyofams/react-ui": "1.0.3",
"@storyofams/react-ui": "1.2.0-beta.1",
"@styled-system/css": "5.1.5",
"@styled-system/props": "5.1.5",
"@svgr/webpack": "5.5.0",
"@zeit/next-source-maps": "0.0.3",
"axios": "0.21.1",
"date-fns": "2.16.1",
"fontfaceobserver": "2.1.0",
"framer-motion": "^3.10.2",
"next": "10.0.5",
"next-seo": "4.17.0",
"object-fit-images": "3.2.4",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-flatpickr": "^3.10.7",
"react-hook-form": "6.14.2",
"react-id-generator": "3.0.1",
"react-lazyload": "3.1.0",
"react-select": "3.2.0",
"rebass": "4.0.7",
"sitemap": "6.3.5",
"styled-components": "5.2.1",
"styled-system": "5.1.5",
Expand Down
7 changes: 7 additions & 0 deletions public/static/fonts/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
url('DomaineDisp-Bold.woff') format('woff');
font-weight: bold;
font-style: normal;
font-display: swap;
}

@font-face {
Expand All @@ -12,6 +13,7 @@
url('Inter-Bold.woff') format('woff');
font-weight: bold;
font-style: normal;
font-display: swap;
}

@font-face {
Expand All @@ -20,6 +22,7 @@
url('Inter-BoldItalic.woff') format('woff');
font-weight: bold;
font-style: italic;
font-display: swap;
}

@font-face {
Expand All @@ -28,6 +31,7 @@
url('Inter-Regular.woff') format('woff');
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
Expand All @@ -36,6 +40,7 @@
url('Inter-Italic.woff') format('woff');
font-weight: normal;
font-style: italic;
font-display: swap;
}

@font-face {
Expand All @@ -44,6 +49,7 @@
url('Inter-Medium.woff') format('woff');
font-weight: 500;
font-style: normal;
font-display: swap;
}

@font-face {
Expand All @@ -52,5 +58,6 @@
url('Inter-MediumItalic.woff') format('woff');
font-weight: 500;
font-style: italic;
font-display: swap;
}

2 changes: 1 addition & 1 deletion src/components/common/Image/image.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Stack } from '@storyofams/react-ui';
import { Box } from 'rebass/styled-components';
import { Box } from '@storyofams/react-ui';

import { Image, ImageProps } from '~components';

Expand Down
14 changes: 5 additions & 9 deletions src/components/common/Image/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { Box, System } from '@storyofams/react-ui';
import { pick, omit } from '@styled-system/props';
import NextImage, { ImageProps as NextImageProps } from 'next/image';
import {
Box,
BoxProps,
BoxProps as RebassBoxProps,
} from 'rebass/styled-components';
import { HeightProps, WidthProps } from 'styled-system';

const getHighestValue = (value: any): number | string => {
Expand All @@ -29,7 +25,7 @@ const getHighestValue = (value: any): number | string => {
};

export type ImageProps = Omit<NextImageProps, 'layout' | 'width' | 'height'> &
Omit<BoxProps, 'width' | 'height'> &
Omit<System, 'width' | 'height'> &
(
| {
layout: 'fill';
Expand All @@ -53,18 +49,18 @@ export const Image = (props: ImageProps) => {
NextImageProps,
'width' | 'height'
>;
const rebassImageProps = pick(props) as RebassBoxProps;
const imageProps = pick(props);

if (props.layout === 'fill') {
return (
<Box {...rebassImageProps} sx={{ position: 'relative' }}>
<Box {...imageProps} sx={{ position: 'relative' }}>
<NextImage layout="fill" {...nextImageProps} />
</Box>
);
}

return (
<Box {...rebassImageProps}>
<Box {...imageProps}>
<NextImage
height={getHighestValue(props.width)}
width={getHighestValue(props.width)}
Expand Down
24 changes: 13 additions & 11 deletions src/components/home/background/index.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { Flex } from 'rebass/styled-components';
import { Flex, css } from '@storyofams/react-ui';

import { CrossPattern } from './CrossPattern';

export const Background = () => (
<Flex
bg="black"
display="flex"
flexWrap="wrap"
alignContent="start"
justifyContent="space-evenly"
flex={1}
overflow="hidden"
sx={{
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
'&:after': {
content: "''",
position="absolute"
top={0}
right={0}
bottom={0}
left={0}
css={css({
backgroundColor: 'black',
color: 'blue',
'&::after': {
content: '""',
position: 'fixed',
top: 0,
left: 0,
Expand All @@ -26,7 +28,7 @@ export const Background = () => (
background:
'radial-gradient(circle, rgba(0,0,0,0.75) 0%, rgba(0,0,0,75) 80%);',
},
}}
})}
>
<CrossPattern />
</Flex>
Expand Down
1 change: 0 additions & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import objectFitImages from 'object-fit-images';
import { Providers } from '~components';
import { seo } from '~config';
import { initSentry } from '~lib';

import CSSreset from '~styles/CSSreset';

import '../../public/static/fonts/stylesheet.css';
Expand Down
35 changes: 19 additions & 16 deletions src/pages/_error.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Button, Box, Flex, Heading, Text } from '@storyofams/react-ui';
import { NextSeo } from 'next-seo';
import { Button, Flex, Link, Text } from 'rebass/styled-components';

import { Background } from '~components/home/background';

const getError = ({ res, err }) => {
const statusCode = res ? res.statusCode : err ? err.statusCode : 404;
Expand All @@ -25,21 +27,22 @@ const Error = ({ statusCode }) => {
return (
<>
<NextSeo title={statusCode} description={content} />
<Flex
height="100vh"
backgroundColor="black"
justifyContent="center"
alignItems="center"
flexDirection="column"
>
<Text fontFamily="mono" fontSize={9} color="white">
{statusCode}
</Text>
<Text color="white">{content}</Text>
<Link href="/">
<Button mt={3}>Take me home</Button>
</Link>
</Flex>
<Background />
<Box pt={'50vh' as any} position="relative">
<Flex
variant="center"
flexDirection="column"
transform="translateY(-50%)"
>
<Heading fontFamily="mono" fontSize={8} color="white">
{statusCode}
</Heading>
<Text color="white">{content}</Text>
<Button as="a" variant="link" to="/" mt={2} color="white">
Take me home
</Button>
</Flex>
</Box>
</>
);
};
Expand Down
8 changes: 4 additions & 4 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { Heading, Box } from '@storyofams/react-ui';
import { NextSeo } from 'next-seo';
import { Heading, Box } from 'rebass/styled-components';
import { Background } from '~components/home';

const Home = () => (
<>
<NextSeo title="Home" description="What will your Story be?" />
<Background />
<Box pt="50vh" sx={{ position: 'relative' }}>
<Box pt={'50vh' as any} position="relative">
<Heading
fontSize={[6, 9]}
fontSize={[6, 8]}
color="white"
textAlign="center"
sx={{ transform: 'translateY(-50%)' }}
transform="translateY(-50%)"
>
What will your Story be?
</Heading>
Expand Down
21 changes: 3 additions & 18 deletions src/styles/CSSreset.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
import { createGlobalStyle, css } from 'styled-components';

const themeStyles = ({ theme }) => css`
/* typograhpy */
body.font-loaded {
font-family: ${theme.fonts.body};
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: ${theme.fontSizes.heading};
font-family: ${theme.fonts.heading};
}
}
html {
font-size: ${theme.fontSizes.root};
font-size: ${theme.fontSizes.root}px;
font-weight: ${theme.fontWeights.regular};
/* outline only when the user is using tab */
&:not(.user-is-tabbing) {
a[href],
Expand Down Expand Up @@ -268,8 +254,7 @@ const CSSreset = createGlobalStyle(
h4,
h5,
h6 {
font-size: inherit;
font-weight: inherit;
font-family: ${theme.fonts.heading};
}
a {
color: inherit;
Expand Down
12 changes: 0 additions & 12 deletions src/styles/fonts.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/styles/styled.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'styled-components';
interface Breakpoints extends Array<string> {
export interface Breakpoints extends Array<string> {
sm?: string;
md?: string;
lg?: string;
Expand Down
Loading

1 comment on commit aff556e

@vercel
Copy link

@vercel vercel bot commented on aff556e Mar 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.