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

Feature/teddy #7

Closed
wants to merge 12 commits into from
10 changes: 7 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"extends": "next/core-web-vitals",
"plugins": ["@stylexjs"],
"rules": { "@stylexjs/valid-styles": "error" }
}
"plugins": [
"@stylexjs"
],
"rules": {
"@stylexjs/valid-styles": "error"
}
}
19 changes: 16 additions & 3 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import '@/shared/ui/styles/globals.css';
import stylex from '@stylexjs/stylex';
import React from 'react';
import { Navbar } from '@/widgets/navbar';
import { ThemeProvider } from 'next-themes';
import ThemeToggle from '@/widgets/ThemeToggle';

export const metadata: Metadata = {
title: 'GDSC DJU',
Expand All @@ -17,9 +19,15 @@ export default function RootLayout({
}) {
return (
<html {...stylex.props(styles.html)} lang="en">
<body {...stylex.props(styles.body)}>
<Navbar />
<main>{children}</main>
<body
{...stylex.props(styles.body)}
className={`${styles.body} dark: ${styles.dark}`}
>
<ThemeProvider attribute="class">
<Navbar />
<ThemeToggle />
<main>{children}</main>
</ThemeProvider>
</body>
</html>
);
Expand All @@ -35,6 +43,11 @@ const styles = stylex.create({
padding: 0,
},
body: {
backgroundColor: 'white',
color: 'rgb(20, 22, 27)',
},
dark: {
backgroundColor: 'black',
color: 'white',
},
});
29 changes: 29 additions & 0 deletions app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Link from 'next/link';
import * as stylex from '@stylexjs/stylex';
import { sizes } from '../src/shared/ui/styles/tokens.stylex';

export const styles = stylex.create({
container: {
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
textAlign: 'center',
display: 'flex',
flexDirection: 'column',
gap: '20px',
},
header: {
fontSize: sizes.title1_bold,
},
});

export default function NotFound() {
return (
<div {...stylex.props(styles.container)}>
<h2 {...stylex.props(styles.header)}>찾을수 없습니다</h2>
<p>잘못된 경로로 접근했습니다!!</p>
<Link href="/">홈으로 돌아가기</Link>
</div>
);
}
Empty file added app/teddy/monthly/page.tsx
Empty file.
5 changes: 2 additions & 3 deletions app/wakatime/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import WakatimeMain from "@/views/wakatime/ui/wakatime-main"

const Wakatime = () => {
return (
<div>page</div>
)
return <WakatimeMain/>
}

export default Wakatime
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@stylexjs/open-props": "^0.6.0",
"@stylexjs/stylex": "^0.6.0",
"next": "14.2.1",
"next-themes": "^0.3.0",
"react": "^18",
"react-dom": "^18"
},
Expand All @@ -28,4 +29,4 @@
"eslint-config-next": "14.2.1",
"typescript": "^5.4.5"
}
}
}
1 change: 1 addition & 0 deletions src/features/update-button/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { TeddyCategory } from './ui/change-teddyCategory';
export { ChangeNavBarColor } from './ui/change-navbarCategory';
59 changes: 59 additions & 0 deletions src/features/update-button/ui/change-navbarCategory.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use client';

import Link from 'next/link';
import { usePathname } from 'next/navigation';
import * as stylex from '@stylexjs/stylex';
import { colors } from '../../../shared/ui/styles/tokens.stylex';

export const styles = stylex.create({
category: {
textDecoration: 'none',
},
categoryHover: {
color: {
default: 'black',
':hover': colors.blueCore,
},
borderBottomWidth: {
':hover': '1px',
},
borderColor: {
':hover': colors.blueCore,
},
borderStyle: {
':hover': 'solid',
},
},
active: {
color: colors.blueCore,
},
});

export const ChangeNavBarColor = () => {
const NavBarPath = usePathname();

const NavBarData = [
{ name: 'wakatime', path: '/wakatime' },
{ name: 'teddy', path: '/teddy' },
{ name: 'members', path: '/members' },
{ name: 'blog', path: '/blog' },
];

return (
<>
{NavBarData.map((category, index) => (
<Link
href={category.path}
key={index}
{...stylex.props(
styles.category,
styles.categoryHover,
NavBarPath === category.path ? styles.active : undefined,
)}
>
{category.name}
</Link>
))}
</>
);
};
2 changes: 1 addition & 1 deletion src/features/update-button/ui/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { colors, sizes } from '../../../shared/ui/styles/tokens.stylex';

export const styles = stylex.create({
teddyCategoryContainer: {
width: "1200px",
width: '1200px',
margin: '0 auto',
display: 'flex',
paddingLeft: '120px',
Expand Down
5 changes: 5 additions & 0 deletions src/shared/ui/icons/1등 메달.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/shared/ui/icons/2등 메달.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/shared/ui/icons/3등 메달.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/shared/ui/icons/leftButton.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/shared/ui/icons/rightButton.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/shared/ui/styles/tokens.stylex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const sizes = stylex.defineVars({
title1_bold: '20px',
title2_medium: '14px',
body1_medium: '18px',
body1_medium_16: '16px',
body2_regular: '16px',
body3_regular: '14px',
caption1_regular: '12px',
Expand Down
Empty file.
1 change: 0 additions & 1 deletion src/views/teddy/ui/teddy-weekly.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export const styles = stylex.create({
container: {
width: '1200px',
margin: '0 auto',
paddingLeft: '120px',
paddingTop: '115px',
},
});
Expand Down
Empty file added src/views/wakatime/index.tsx
Empty file.
15 changes: 15 additions & 0 deletions src/views/wakatime/ui/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as stylex from '@stylexjs/stylex';
import {
colors,
sizes,
fontWeight,
} from '../../../shared/ui/styles/tokens.stylex';

export const styles = stylex.create({
container: {
width: '1200px',
margin: '0 auto',
paddingLeft: '120px',
paddingTop: '115px',
},
});
13 changes: 13 additions & 0 deletions src/views/wakatime/ui/wakatime-main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Image from 'next/image';
import { styles } from './style';
import stylex from '@stylexjs/stylex';

const WakatimeMain = () => {
return (
<div {...stylex.props(styles.container)}>
wakatime-main
</div>
)
}

export default WakatimeMain
5 changes: 4 additions & 1 deletion src/widgets/Navbar/ui/navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
'use client';

import React from 'react';
import Link from 'next/link';
import stylex from '@stylexjs/stylex';
import Image from 'next/image';
import Logo from '@/shared/ui/icons/GDSCLogo.svg';
import { styles } from './styles';
import { ChangeNavBarColor } from '@/features/update-button/ui/change-navbarCategory';

export const Navbar = () => {
return (
Expand All @@ -16,7 +19,7 @@ export const Navbar = () => {
href="/wakatime"
{...stylex.props(styles.category, styles.categoryHover)}
>
<span>wakatime</span>
<p>wakatime</p>
</Link>
<Link
href="/teddy"
Expand Down
36 changes: 36 additions & 0 deletions src/widgets/ThemeToggle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use client';

import stylex from '@stylexjs/stylex';

import { useTheme } from 'next-themes';
import { useEffect, useState } from 'react';

const ThemeToggle = () => {
const { theme, setTheme } = useTheme();
const [mounted, setMounted] = useState(false);

useEffect(() => {
setMounted(true);
}, []);

if (!mounted) return null;

return (
<button
{...stylex.props(styles.themeButton)}
onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}
>
Toggle Theme
</button>
);
};

const styles = stylex.create({
themeButton: {
position: 'absolute',
right: 50,
top: 20,
},
});

export default ThemeToggle;
3 changes: 2 additions & 1 deletion src/widgets/teddyIntro/ui/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export const styles = stylex.create({
},

content: {
fontSize: sizes.body1_medium,
fontSize: sizes.body1_medium_16,
lineHeight: '130%',
},

contentsContainer: {
Expand Down
1 change: 1 addition & 0 deletions src/widgets/teddyIntro/ui/teddyIntro.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react';
import { styles } from './style';
import stylex from '@stylexjs/stylex';

Expand Down
Empty file.
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
"exclude": [
"node_modules"
]
}
}