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(*): GlobalStyles(Reset) 및 RootLayout 적용 #61

Merged
merged 7 commits into from
Jul 20, 2024
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
77 changes: 0 additions & 77 deletions apps/web/app/globals.css

This file was deleted.

10 changes: 5 additions & 5 deletions apps/web/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Providers } from '@sambad/web-domains/commmon';
import { Providers, RootLayout as ViewportLayout } from '@sambad/web-domains/commmon';
import { Inter } from 'next/font/google';

import type { Metadata } from 'next';

import './globals.css';

const inter = Inter({ subsets: ['latin'] });

export const metadata: Metadata = {
Expand All @@ -18,9 +16,11 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang="en">
<html lang="ko">
<body className={inter.className}>
<Providers>{children}</Providers>
<Providers>
<ViewportLayout>{children}</ViewportLayout>
</Providers>
</body>
</html>
);
Expand Down
11 changes: 10 additions & 1 deletion apps/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
}
]
},
"include": ["next-env.d.ts", "next.config.js", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": [
"next-env.d.ts",
"next.config.js",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"../../packages/web-domains/src/common/styles/GlobalStyles.tsx",
"../../packages/web-domains/src/common/layout/RootLayout.styles.ts",
"../../packages/web-domains/src/common/layout/RootLayout.tsx"
],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"@emotion/react": "^11.11.4"
},
"devDependencies": {
"@turbo/gen": "^1.12.4",
"cspell": "^8.10.0",
"husky": "^9.0.11",
"next": "14.2.4",
"prettier": "^3.2.5",
"turbo": "^2.0.4",
"@turbo/gen": "^1.12.4",
"typescript": "^5.4.5"
},
"packageManager": "[email protected]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export const useHealthCheckQuery = () => {
export const useHealthCheckPrefetchQuery = async () => {
const queryClient = new QueryClient();

const prefetchedData = await queryClient.prefetchQuery({
queryKey: ['health'],
queryFn: ping,
});
// const prefetchedData = await queryClient.prefetchQuery({
// queryKey: ['health'],
// queryFn: ping,
// });

return {
queryClient,
prefetchedData,
// prefetchedData,
};
};
2 changes: 2 additions & 0 deletions packages/web-domains/src/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export { QueryClientProvider } from './contexts/QueryClientProvider';
export { Providers } from './contexts/Providers';
export { RootLayout } from './layout/RootLayout';
export { GlobalStyle } from './styles/GlobalStyles';
7 changes: 7 additions & 0 deletions packages/web-domains/src/common/layout/RootLayout.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { css } from '@emotion/react';

export const RootLayoutCss = css({
width: '100%',
maxWidth: '600px',
margin: '0 auto',
});
20 changes: 20 additions & 0 deletions packages/web-domains/src/common/layout/RootLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use client';

import { ReactNode } from 'react';

import { GlobalStyle } from '../styles/GlobalStyles';

import { RootLayoutCss } from './RootLayout.styles';

interface RootLayoutProps {
children: ReactNode;
}

export const RootLayout = ({ children }: RootLayoutProps) => {
return (
<div>
<GlobalStyle />
<div css={RootLayoutCss}>{children}</div>
</div>
);
};
103 changes: 103 additions & 0 deletions packages/web-domains/src/common/styles/GlobalStyles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
'use client';

import { Global, css } from '@emotion/react';

export const GlobalStyle = () => {
return <Global styles={reset} />;
};

const reset = css`
*,
*::before,
*::after {
box-sizing: border-box;
padding: 0;
margin: 0;
}

html {
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
text-size-adjust: none;
}

body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
margin-block-end: 0;
}

ul[role='list'],
ol[role='list'] {
list-style: none;
}

body {
max-width: 100vw;
min-height: 100vh;
line-height: 1.5;
overflow-x: hidden;
}

h1,
h2,
h3,
h4,
button,
input,
label {
line-height: 1.1;
}

a:not([class]) {
text-decoration-skip-ink: auto;
color: currentColor;
}

img,
picture {
max-width: 100%;
display: block;
}

input,
button,
textarea,
select {
font: inherit;
}

input {
border: none;
}

textarea {
resize: none;
border: none;
}

button {
border: none;
background: none;
}

a {
color: inherit;
text-decoration: none;
}

textarea:not([rows]) {
min-height: 10em;
}

:target {
scroll-margin-block: 5ex;
}
`;
2 changes: 1 addition & 1 deletion packages/web-domains/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"include": ["src", "../../apps/web/layout/RootLayout.styles.ts", "../../apps/web/layout/RootLayout.tsx"],
"exclude": ["node_modules", "dist"]
}
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.