app.js(app.js)에 globalstyles를 import하고,
import { ApolloClient, ApolloProvider, InMemoryCache } from "@apollo/client";
import { Global } from "@emotion/react";
import "antd/dist/antd.css";
import { AppProps } from "next/dist/shared/lib/router/router";
import { globalStyles } from "../src/commons/styles/globalStyles";
import Layout from "../src/components/commons/layout/index";
function MyApp({ Component, pageProps }: AppProps) {
const client = new ApolloClient({
uri: "http://example.codebootcamp.co.kr/graphql",
cache: new InMemoryCache(),
});
return (
<ApolloProvider client={client}>
<Global styles={globalStyles} />
<Layout>
<Component {...pageProps} />
</Layout>
</ApolloProvider>
);
}
export default MyApp;
src폴더에 globalStyles.ts폴더를 만들어서 아래처럼 설정해주었다.
import { css } from "@emotion/react";
export const globalStyles = css`
* {
margin: 0px;
box-sizing: border-box;
/* font-size: 50px; */
font-family: "myFont";
}
@font-face {
font-family: "myFont";
src: url("/fonts/scifibit.ttf");
}
`;
emotion을 통해 global style을 만드는 방법이었다.