Skip to content
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-hook-form": "^7.56.4",
"react-icons": "^5.5.0",
"tailwind-merge": "^3.3.0",
"tailwindcss": "^4.1.7"
},
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

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

21 changes: 21 additions & 0 deletions src/app/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

--spacing-normal: 20px;
--spacing-normal-half: 10px;
--spacing-mt: 24px;

--radius-lg: 20px;
--radius-md: 12px;
Expand Down Expand Up @@ -86,6 +87,18 @@ input[type='number'] {
scrollbar-width: none;
}

.overlay {
position: fixed;
inset: 0;
z-index: 300;
background-color: rgba(0, 0, 0, 0);
transition: background-color 0.3s ease-in-out;
}

.overlay-visible {
background-color: rgba(0, 0, 0, 0.2);
}

.logo {
font-family: Fredoka;
}
Expand All @@ -105,4 +118,12 @@ input[type='number'] {
.shadow-noticeItem {
box-shadow: 2px 8px 40px -3.034px rgba(50, 65, 96, 0.1);
}

.shadow-resultItem {
box-shadow: 8px 8px 30px 0px rgba(55, 127, 248, 0.16);
}

.shadow-resultContent {
box-shadow: 11px 8px 30px rgba(55, 127, 248, 0.16);
}
}
11 changes: 10 additions & 1 deletion src/app/stackflow/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@ import { LoginScreen } from '@/screen/login/ui';
import { HomeScreen } from '@/screen/home/ui';
import { NoticeScreen } from '@/screen/notice/ui';
import { NoticeContentScreen } from '@/screen/notice-content/ui';
import { VoteResultScreen } from '@/screen/vote-result/ui';
import { VoteResultContentScreen } from '@/screen/vote-result-content/ui';

export const { Stack, useFlow } = stackflow({
transitionDuration: 350,
activities: { NoticeScreen, NoticeContentScreen, LoginScreen, HomeScreen },
activities: {
NoticeScreen,
NoticeContentScreen,
VoteResultScreen,
VoteResultContentScreen,
LoginScreen,
HomeScreen,
},
plugins: [
basicRendererPlugin(),
basicUIPlugin({
Expand Down
34 changes: 34 additions & 0 deletions src/assets/icon/icon-vote.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion src/assets/icon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@ import ResultIcon from './icon-result.svg';
import NoticeIcon from './icon-notice.svg';
import NotificationIcon from './icon-notification.svg';
import MessageIcon from './icon-message.svg';
import VoteIcon from './icon-vote.svg';

export { UserIcon, ResultIcon, NoticeIcon, NotificationIcon, MessageIcon };
export {
UserIcon,
ResultIcon,
NoticeIcon,
NotificationIcon,
MessageIcon,
VoteIcon,
};
2 changes: 1 addition & 1 deletion src/features/notice/ui/NoticeItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function NoticeItem({ id, title, type, date }: Notice) {
return (
<button
name={`${id}`}
className="flex w-full cursor-pointer items-center overflow-hidden px-5 py-6 focus:outline-none"
className="flex w-full cursor-pointer items-center overflow-hidden py-6 focus:outline-none"
onClick={() =>
push(PATH.NOTICE_CONTENT, { notice: { id, title, type, date } })
}
Expand Down
6 changes: 1 addition & 5 deletions src/screen/notice-content/ui/NoticeContentScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ const NoticeContentScreen: ActivityComponentType<{ notice: Notice }> = ({
params: { notice: Notice };
}) => {
return (
<AppScreen
preventSwipeBack
backgroundColor="#fff"
appBar={TitleAppBar('공지사항')}
>
<AppScreen backgroundColor="#fff" appBar={TitleAppBar('공지사항')}>
<NoticeContentContainer title={params.notice.title} />
</AppScreen>
);
Expand Down
6 changes: 1 addition & 5 deletions src/screen/notice/ui/NoticeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import { NoticeContainer } from '@/widgets/notice/ui';

export default function NoticeScreen() {
return (
<AppScreen
preventSwipeBack
backgroundColor="#fff"
appBar={TitleAppBar('공지사항')}
>
<AppScreen backgroundColor="#fff" appBar={TitleAppBar('공지사항')}>
<NoticeContainer />
</AppScreen>
);
Expand Down
14 changes: 14 additions & 0 deletions src/screen/vote-result-content/ui/VoteResultContentScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { AppScreen } from '@stackflow/plugin-basic-ui';

import { TitleAppBar } from '@/shared/ui';
import { VoteResultContentContainer } from '@/widgets/vote-result-content/ui';

export default function VoteResultContentScreen() {
return (
<>
<AppScreen backgroundColor="#fff" appBar={TitleAppBar()}>
<VoteResultContentContainer />
</AppScreen>
</>
);
}
1 change: 1 addition & 0 deletions src/screen/vote-result-content/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as VoteResultContentScreen } from './VoteResultContentScreen';
23 changes: 23 additions & 0 deletions src/screen/vote-result/ui/VoteResultScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useState } from 'react';
import { AppScreen } from '@stackflow/plugin-basic-ui';

import { TitleAppBar } from '@/shared/ui';
import {
VoteResultBottomSheet,
VoteResultContainer,
} from '@/widgets/vote-result/ui';

export default function VoteResultScreen() {
const [selectedYear, setSelectedYear] = useState<number>(2024);
return (
<>
<AppScreen backgroundColor="#fff" appBar={TitleAppBar('선거결과')}>
<VoteResultContainer selectedYear={selectedYear} />
</AppScreen>
<VoteResultBottomSheet
selectedYear={selectedYear}
setSelectedYear={setSelectedYear}
/>
</>
);
}
1 change: 1 addition & 0 deletions src/screen/vote-result/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as VoteResultScreen } from './VoteResultScreen';
33 changes: 33 additions & 0 deletions src/shared/atom/bottomSheet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { atom } from 'jotai';

import type { BottomSheetItem } from '../types';
import { BOTTOM_SHEET } from '../constants';

type BottomSheetInfo = {
[key in BottomSheetItem]: { isOpen: boolean; isVisible: boolean };
};

const bottomSheet = Object.fromEntries(
Object.keys(BOTTOM_SHEET).map(key => [
key,
{ isOpen: false, isVisible: false },
]),
) as BottomSheetInfo;

export const bottomSheetAtom = atom<BottomSheetInfo>(bottomSheet);

export const updateBottomSheet = atom(
null,
(
get,
set,
update: { key: BottomSheetItem; isOpen: boolean; isVisible: boolean },
) => {
const currentBottomSheet = get(bottomSheetAtom);
const updatedBottomSheet = {
...currentBottomSheet,
[update.key]: { isOpen: update.isOpen, isVisible: update.isVisible },
};
set(bottomSheetAtom, updatedBottomSheet);
},
);
1 change: 1 addition & 0 deletions src/shared/atom/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './bottomSheet';
3 changes: 3 additions & 0 deletions src/shared/constants/bottomSheet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const BOTTOM_SHEET = {
VOTE_RESULT: 'VoteResultBottomSheet',
} as const;
1 change: 1 addition & 0 deletions src/shared/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './path';
export * from './bottomSheet';
2 changes: 2 additions & 0 deletions src/shared/constants/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ export const PATH = {
LOGIN: 'LoginScreen',
NOTICE: 'NoticeScreen',
NOTICE_CONTENT: 'NoticeContentScreen',
VOTE_RESULT: 'VoteResultScreen',
VOTE_RESULT_CONTENT: 'VoteResultContentScreen',
} as const;
1 change: 1 addition & 0 deletions src/shared/hook/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as useBottomSheet } from './useBottomSheet';
34 changes: 34 additions & 0 deletions src/shared/hook/useBottomSheet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { useAtomValue, useSetAtom } from 'jotai';

import { bottomSheetAtom, updateBottomSheet } from '../atom';
import type { BottomSheetItem } from '../types';

export default function useBottomSheet() {
const bottomSheet = useAtomValue(bottomSheetAtom);
const setBottomSheet = useSetAtom(updateBottomSheet);

const bottomSheetState = (key: BottomSheetItem) =>
bottomSheet[key] || { isOpen: false };

const openBottomSheet = (key: BottomSheetItem) => {
setBottomSheet({ key, isOpen: true, isVisible: false });
setTimeout(
() => setBottomSheet({ key, isOpen: true, isVisible: true }),
100,
);
};

const closeBottomSheet = (key: BottomSheetItem) => {
setBottomSheet({ key, isOpen: true, isVisible: false });
setTimeout(
() => setBottomSheet({ key, isOpen: false, isVisible: false }),
300,
);
};

return {
bottomSheetState,
openBottomSheet,
closeBottomSheet,
};
}
3 changes: 3 additions & 0 deletions src/shared/types/bottomSheet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { BOTTOM_SHEET } from '../constants';

export type BottomSheetItem = (typeof BOTTOM_SHEET)[keyof typeof BOTTOM_SHEET];
1 change: 1 addition & 0 deletions src/shared/types/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './path';
export * from './bottomSheet';
4 changes: 2 additions & 2 deletions src/shared/ui/AppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

const baseStyle = { height: '58px', border: false };

export const BasicAppBar = {

Check warning on line 6 in src/shared/ui/AppBar.tsx

View workflow job for this annotation

GitHub Actions / Pipelines (lint)

Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components
...baseStyle,
backgroundImage: `url(${LoginBg})`,
renderLeft: () => (
Expand All @@ -11,7 +11,7 @@
),
};

export const HomeAppBar = {

Check warning on line 14 in src/shared/ui/AppBar.tsx

View workflow job for this annotation

GitHub Actions / Pipelines (lint)

Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components
...baseStyle,
backgroundImage: `url(${HomeBg})`,
renderLeft: () => (
Expand All @@ -20,8 +20,8 @@
renderRight: () => <img src={UserIcon} alt="user" className="mr-[4px]" />,
};

export const TitleAppBar = (title: string) => ({
export const TitleAppBar = (title?: string) => ({
...baseStyle,
backgroundColor: '#fff',
title: title,
title: title || '',
});
34 changes: 34 additions & 0 deletions src/shared/ui/BottomSheet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { type ReactNode } from 'react';

import { cn } from '../utils';
import type { BottomSheetItem } from '../types';
import { useBottomSheet } from '../hook';

interface BottomSheetProps {
children: ReactNode;
sheetKey: BottomSheetItem;
}

export default function BottomSheet({ children, sheetKey }: BottomSheetProps) {
const { closeBottomSheet, bottomSheetState } = useBottomSheet();
const { isVisible } = bottomSheetState(sheetKey);
const onClose = () => closeBottomSheet(sheetKey);

return (
<>
<div
className={cn('overlay', isVisible && 'overlay-visible')}
onClick={onClose}
/>
<div
className={cn(
'fixed bottom-0 left-0 z-400 flex h-fit w-full flex-col rounded-t-[32px] bg-white px-[20px] pt-8 pb-18 shadow-lg transition-transform duration-300',
isVisible ? 'translate-y-0' : 'translate-y-full',
isVisible ? 'box-shadow-bottom-sheet block' : '',
)}
>
{children}
</div>
</>
);
}
1 change: 1 addition & 0 deletions src/shared/ui/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './AppBar';
export { default as Button } from './Button';
export { default as Input } from './Input';
export { default as BottomSheet } from './BottomSheet';
2 changes: 1 addition & 1 deletion src/widgets/home/ui/HomeContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function HomeContainer() {
title="선거결과"
description="역대 선거결과를 확인해보세요"
icon={ResultIcon}
to={PATH.HOME}
to={PATH.VOTE_RESULT}
/>
<ServiceButton
title="공지사항"
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/notice-content/ui/NoticeContentContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default function NoticeContainer({ title }: { title: string }) {

return (
<div className="p-normal scrollbar-hide flex size-full flex-col overflow-scroll">
<p className="mt-6 text-lg font-semibold">{title}</p>
<p className="mt-mt text-lg font-semibold">{title}</p>
<p className="mb-[14px] text-sm font-normal tracking-wide text-[#999]">
2025.03.19
</p>
Expand Down
Loading