Skip to content

Commit

Permalink
feat: implement global styles
Browse files Browse the repository at this point in the history
  • Loading branch information
fariasmateuss committed Feb 20, 2022
1 parent 78b432a commit b9d6608
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 143 deletions.
9 changes: 9 additions & 0 deletions @types/styled.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'styled-components';

import { theme } from 'styles/theme';

export type Theme = typeof theme;

declare module 'styled-components' {
export interface DefaultTheme extends Theme {}
}
6 changes: 3 additions & 3 deletions src/pages/_app.js → pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ThemeProvider } from 'styled-components';

import { theme } from '../styles/theme';
import GlobalStyle from '../styles/globals';
import { theme } from 'styles/theme';
import GlobalStyles from 'styles/global';

function MyApp({ Component, pageProps }) {
return (
<ThemeProvider theme={theme}>
<Component {...pageProps} />
<GlobalStyle />
<GlobalStyles />
</ThemeProvider>
);
}
Expand Down
13 changes: 11 additions & 2 deletions src/pages/_document.js → pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import Document, { Html, Head, Main, NextScript } from 'next/document';
import Document, {
DocumentInitialProps,
DocumentContext,
Html,
Head,
Main,
NextScript,
} from 'next/document';
import { ServerStyleSheet } from 'styled-components';

export default class MyDocument extends Document {
static async getInitialProps(ctx) {
static async getInitialProps(
ctx: DocumentContext,
): Promise<DocumentInitialProps> {
const sheet = new ServerStyleSheet();
const originalRenderPage = ctx.renderPage;

Expand Down
122 changes: 0 additions & 122 deletions styles/Home.module.css

This file was deleted.

27 changes: 27 additions & 0 deletions styles/global.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { createGlobalStyle } from 'styled-components';

export default createGlobalStyle`
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: ${({ theme }) => theme.colors.background};
color: ${({ theme }) => theme.colors.black};
font-family: 'Roboto',sans-serif;
font-size: 1rem;
font-weight: 400;
}
input,
button {
outline: 0;
}
button {
cursor: pointer;
}
`;
16 changes: 0 additions & 16 deletions styles/globals.css

This file was deleted.

9 changes: 9 additions & 0 deletions styles/theme/colors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const colors = {
background: '#055388',
white: '#ffffff',
black: '#000000',
'black-secondary': '#212121',
alto: '#dbdbdb',
title: '#2e384d',
green: 'rgb(81, 215, 100)',
};
5 changes: 5 additions & 0 deletions styles/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { colors } from './colors';

export const theme = {
colors,
};

0 comments on commit b9d6608

Please sign in to comment.