Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions src/pages/auth/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export default function LoginPage() {
{/* ๊ทธ๋ผ๋ฐ์ด์…˜ ์˜์—ญ */}
<div className='relative w-full h-[22vw] min-h-[14rem] max-h-[28rem]'>
<svg
aria-hidden="true"
focusable="false"
xmlns='http://www.w3.org/2000/svg'
viewBox='0 0 402 194'
className='absolute inset-0 w-full h-full'
Expand Down
7 changes: 6 additions & 1 deletion src/pages/chatbot/components/ChattingBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ interface ChattingProps extends VariantProps<typeof chatBubbleStyle> {
export default function Chatting({ message, variant }: ChattingProps) {
return (
<div className='w-full flex flex-col'>
<div className={cn(chatBubbleStyle({ variant }))}>{message}</div>
<div
className={cn(chatBubbleStyle({ variant }))}
aria-label={variant === 'sent' ? '๋‚ด ๋ฉ”์‹œ์ง€' : '์ƒ๋Œ€๋ฐฉ ๋ฉ”์‹œ์ง€'}
>
{message}
</div>
</div>
);
}
2 changes: 2 additions & 0 deletions src/pages/chatbot/components/ChattingInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ export default function ChattingInput({ onSend }: ChattingInputProps) {
onKeyDown={handleKeyDown}
type='text'
placeholder='๋ฌด์—‡์ด๋“  ๋ฌผ์–ด๋ณด์„ธ์š”'
aria-label="์ฑ„ํŒ… ๋ฉ”์‹œ์ง€ ์ž…๋ ฅ"
className='w-full bg-transparent outline-none text-label-lg placeholder:text-gray-300 text-gray-900'
/>
</div>

<button
type='button'
onClick={handleSubmit}
aria-label="๋ฉ”์‹œ์ง€ ์ „์†ก"
className={cn(
'w-[4rem] h-[4rem] flex justify-center items-center rounded-[2rem] bg-mint-500 flex-shrink-0',
)}
Expand Down
18 changes: 14 additions & 4 deletions src/pages/chatbot/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,40 @@ export default function ChatPage() {
</div>

{/* ๋ฉ”์ธ ์ฝ˜ํ…์ธ  */}
<main className={cn(mainStyle())}>
<main
role="log"
aria-label="์ฑ„ํŒ… ๋‚ด์šฉ"
aria-live="polite"
className={cn(mainStyle())}
>
{/* ๋กœ๊ณ  + ๊ธฐ๋ณธ ๋ฉ˜ํŠธ */}
<div className={cn(introStyle())}>
{/* ๋กœ๊ณ  ์ž๋ฆฌ (์ž„์‹œ) */}
<div className='w-[6rem] h-[6rem] rounded-full bg-gray-200 flex-shrink-0' />
<div
className='w-[6rem] h-[6rem] rounded-full bg-gray-200 flex-shrink-0'
aria-hidden="true"
/>
<Chatting
message='์•ˆ๋…•ํ•˜์„ธ์š”, ๊ธ€๋‹ค์—์š”! ๋ถ€์ฒœ์‹œ ์—ฌํ–‰์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ์‰ฝ๊ฒŒ ์•Œ๋ ค๋“œ๋ฆด๊ฒŒ์š”.'
variant='received'
aria-label="๊ธ€๋‹ค์˜ ๋ฉ”์‹œ์ง€: ์•ˆ๋…•ํ•˜์„ธ์š”, ๊ธ€๋‹ค์—์š”! ๋ถ€์ฒœ์‹œ ์—ฌํ–‰์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ์‰ฝ๊ฒŒ ์•Œ๋ ค๋“œ๋ฆด๊ฒŒ์š”."
/>
<Chatting
message='์›ํ•˜์‹œ๋Š” ์ •๋ณด๋ฅผ ๋ฌผ์–ด๋ด์ฃผ์„ธ์š”!'
variant='received'
aria-label="๊ธ€๋‹ค์˜ ๋ฉ”์‹œ์ง€: ์›ํ•˜์‹œ๋Š” ์ •๋ณด๋ฅผ ๋ฌผ์–ด๋ด์ฃผ์„ธ์š”!"
/>
</div>

{/* ์‚ฌ์šฉ์ž ๋ฉ”์‹œ์ง€ */}
{messages
.filter((msg) => msg.id > 2)
.map((msg) => (
<Chatting key={msg.id} message={msg.text} variant={msg.variant} />
<Chatting key={msg.id} message={msg.text} variant={msg.variant} aria-label={msg.variant === 'sent' ? '๋‚ด ๋ฉ”์‹œ์ง€' : '๊ธ€๋‹ค์˜ ๋ฉ”์‹œ์ง€'}/>
))}

{/* ์Šคํฌ๋กค */}
<div ref={bottomRef} />
<div ref={bottomRef} aria-hidden="true" />
</main>

{/* ์ž…๋ ฅ์ฐฝ */}
Expand Down
7 changes: 6 additions & 1 deletion src/pages/events/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ const EventDetailPage = () => {
)}
>
{/* ํ–‰์‚ฌ ๊ธฐ๊ฐ„ */}
<div className={cn('flex justify-center w-[18.4rem] mt-[1.3rem]')}>
<div aria-label="ํ–‰์‚ฌ ๊ธฐ๊ฐ„" className={cn('flex justify-center w-[18.4rem] mt-[1.3rem]')}>
<DateTag startDate={startDate} endDate={endDate} />
</div>

{/* ๋Œ€ํ‘œ ์ด๋ฏธ์ง€ */}
<section
aria-label="ํ–‰์‚ฌ ๋Œ€ํ‘œ ์ด๋ฏธ์ง€"
className={cn(
'relative w-full flex justify-center max-w-[35.4rem]',
'mt-[1rem]'
Expand All @@ -55,12 +56,15 @@ const EventDetailPage = () => {
) : (
<div
className={cn('w-full h-[43.6rem] bg-gray-200 rounded-[2rem]')}
role="img"
aria-label={`${name} ์ด๋ฏธ์ง€๊ฐ€ ์ œ๊ณต๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.`}
/>
)}
</section>

{/* ํ–‰์‚ฌ ์นด๋“œ */}
<div
aria-label="ํ–‰์‚ฌ ์ •๋ณด"
className={cn(
'flex flex-col items-center w-full gap-[0.8rem]',
'mt-[0.8rem]'
Expand All @@ -76,6 +80,7 @@ const EventDetailPage = () => {

{/* ๊ด€๋ จ ํ–‰์‚ฌ */}
<div
aria-label="๊ด€๋ จ ํ–‰์‚ฌ ๋ชฉ๋ก"
className={cn(
'grid grid-cols-2 gap-[1.2rem] justify-items-center w-full max-w-[35.4rem]'
)}
Expand Down
8 changes: 6 additions & 2 deletions src/pages/events/components/DateTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ export default function DateTag({
if (!startDate && !endDate) return null;

return (
<div className={cn(dateTagStyle(), className)}>
{formatDate(startDate)} ~ {formatDate(endDate)}
<div
className={cn(dateTagStyle(), className)}
role="text"
aria-label={`${startDate}๋ถ€ํ„ฐ ${endDate}๊นŒ์ง€`}
>
{formatDate(startDate)} ~ {formatDate(endDate)}
</div>
);
}
11 changes: 10 additions & 1 deletion src/pages/events/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,17 @@ export default function EventPage() {
<main className='w-full pt-[6.3rem] flex flex-col items-center'>
{/* ๋‚ ์งœ ์„ ํƒ */}
<div className='w-full mt-[3.7rem] flex justify-start'>
{/* ์Šคํฌ๋ฆฐ๋ฆฌ๋”๊ฐ€ โ€œ๋‚ ์งœ ์„ ํƒโ€์œผ๋กœ ์ฝํžˆ๋„๋ก ์ถ”๊ฐ€ */}
<label htmlFor="event-date" className="sr-only">
ํ–‰์‚ฌ ๋‚ ์งœ ์„ ํƒ
</label>
<DatePicker value={date} onChange={setDate} />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ› ๏ธ Refactor suggestion | ๐ŸŸ  Major

๐Ÿงฉ Analysis chain

label์˜ htmlFor ์†์„ฑ์ด DatePicker์™€ ์—ฐ๊ฒฐ๋˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

htmlFor="event-date"๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์ง€๋งŒ, DatePicker ์ปดํฌ๋„ŒํŠธ์— ํ•ด๋‹น id๋ฅผ ์ „๋‹ฌํ•˜์ง€ ์•Š๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. DatePicker๊ฐ€ ๋‚ด๋ถ€์ ์œผ๋กœ id="event-date"๋ฅผ ๊ฐ€์ง„ input์„ ๋ Œ๋”๋งํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด label๊ณผ input์˜ ์—ฐ๊ฒฐ์ด ์ž‘๋™ํ•˜์ง€ ์•Š์•„ ์ ‘๊ทผ์„ฑ์ด ์†์ƒ๋ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋กœ DatePicker ์ปดํฌ๋„ŒํŠธ์˜ ๊ตฌํ˜„์„ ํ™•์ธํ•˜์„ธ์š”:

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•:

Option 1: DatePicker์— id prop ์ „๋‹ฌ

-          <label htmlFor="event-date" className="sr-only">
+          <label htmlFor="event-date-picker" className="sr-only">
            ํ–‰์‚ฌ ๋‚ ์งœ ์„ ํƒ
          </label>
-          <DatePicker value={date} onChange={setDate} />
+          <DatePicker id="event-date-picker" value={date} onChange={setDate} />

Option 2: htmlFor ์ œ๊ฑฐํ•˜๊ณ  aria-label ์‚ฌ์šฉ

-          <label htmlFor="event-date" className="sr-only">
-            ํ–‰์‚ฌ ๋‚ ์งœ ์„ ํƒ
-          </label>
-          <DatePicker value={date} onChange={setDate} />
+          <div aria-label="ํ–‰์‚ฌ ๋‚ ์งœ ์„ ํƒ">
+            <DatePicker value={date} onChange={setDate} />
+          </div>

๐Ÿ Script executed:

#!/bin/bash
# Description: DatePicker ์ปดํฌ๋„ŒํŠธ๊ฐ€ id prop์„ ๋ฐ›๋Š”์ง€ ํ™•์ธ

# DatePicker ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„ ์ฐพ๊ธฐ
ast-grep --pattern $'export default function DatePicker($$$) {
  $$$
}'

# ๋˜๋Š” ํŒŒ์ผ ์ฐพ๊ธฐ ๋ฐ ๋‚ด์šฉ ํ™•์ธ
fd DatePicker.tsx --exec cat {}

Length of output: 2620


DatePicker๊ฐ€ ํ‘œ์ค€ input์ด ์•„๋‹ˆ๋ฏ€๋กœ label์˜ htmlFor ์†์„ฑ์ด ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

DatePicker๋Š” Button ๊ธฐ๋ฐ˜์˜ Popover ์ปดํฌ๋„ŒํŠธ๋กœ, id prop์„ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ htmlFor="event-date"๋ฅผ ์‚ฌ์šฉํ•ด๋„ ์—ฐ๊ฒฐํ•  input์ด ์—†์–ด label์ด ๋™์ž‘ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•:

DatePicker ์ปดํฌ๋„ŒํŠธ๋ฅผ ์ˆ˜์ •ํ•˜์—ฌ aria-label prop์„ ์ง€์›ํ•˜๋„๋ก ๋ณ€๊ฒฝ:

interface DatePickerProps {
  value?: Date;
  onChange?: (date: Date) => void;
  defaultValue?: Date;
  className?: string;
+ aria-label?: string;
}
export function DatePicker({
  value,
  onChange,
  defaultValue,
  className,
+ 'aria-label': ariaLabel,
  ...calendarProps
}: DatePickerProps) {
  // ...
  return (
    <div className={cn('flex flex-col gap-3', className)}>
      <Popover open={open} onOpenChange={setOpen}>
        <PopoverTrigger asChild>
-          <Button className='w-[16rem] h-[4rem] justify-between rounded-[500px] text-label-lg text-pink-300 bg-pink-50 border border-pink-100'>
+          <Button aria-label={ariaLabel} className='w-[16rem] h-[4rem] justify-between rounded-[500px] text-label-lg text-pink-300 bg-pink-50 border border-pink-100'>

๊ทธ ํ›„ ์‚ฌ์šฉ ์‹œ:

-          <label htmlFor="event-date" className="sr-only">
-            ํ–‰์‚ฌ ๋‚ ์งœ ์„ ํƒ
-          </label>
-          <DatePicker value={date} onChange={setDate} />
+          <DatePicker aria-label="ํ–‰์‚ฌ ๋‚ ์งœ ์„ ํƒ" value={date} onChange={setDate} />

Committable suggestion skipped: line range outside the PR's diff.

</div>

{/* ํ–‰์‚ฌ์นด๋“œ & ๋นˆํ™”๋ฉด */}
{filteredEvents.length > 0 ? (
<section
aria-label="์ด๋ฒคํŠธ ๋ชฉ๋ก"
className={cn(
'grid w-full mt-[1.4rem]',
'grid-cols-2 gap-x-[1.4rem] gap-y-[1.4rem]',
Expand All @@ -74,7 +79,11 @@ export default function EventPage() {
))}
</section>
) : (
<div className='flex flex-col items-center justify-center text-center mt-[15rem]'>
<div
className='flex flex-col items-center justify-center text-center mt-[15rem]'
role='status'
aria-live='polite'
>
<Icon name='Stamp' size={120} color='gray-200' />
<h2 className='text-headline-lg-serif text-gray-700 mt-[5rem]'>
Ooops!
Expand Down
18 changes: 15 additions & 3 deletions src/pages/loading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ import loading_revised from '../../../public/lottie/loading_revised.json';

export default function Loading() {
return (
<div className='flex flex-col items-center justify-between h-[100vh] bg-white'>
<div className='relative w-full h-[22vw] min-h-[14rem] max-h-[28rem]'>
<div
className='flex flex-col items-center justify-between h-[100vh] bg-white'
role='status'
aria-live='polite'
aria-label='ํŽ˜์ด์ง€ ๋กœ๋”ฉ ์ค‘์ž…๋‹ˆ๋‹ค'
>
<div
className='relative w-full h-[22vw] min-h-[14rem] max-h-[28rem]'
aria-hidden="true"
>
<svg
xmlns='http://www.w3.org/2000/svg'
viewBox='0 0 402 194'
Expand All @@ -19,12 +27,16 @@ export default function Loading() {
</svg>
</div>

<div className='flex items-center justify-center'>
<div
className='flex items-center justify-center'
aria-label="์ฝ˜ํ…์ธ ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘์ž…๋‹ˆ๋‹ค"
>
<Lottie
animationData={loading_revised}
loop
autoplay
className='w-[18rem] h-[18rem]'
aria-hidden="true"
/>
</div>

Expand Down
6 changes: 5 additions & 1 deletion src/pages/main/Board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ const Board = () => {
<div className='relative w-full h-[100vh] bg-[#46d1cd] overflow-auto'>
<Header title='์ง€๋„' onClick={() => router.back()} />

<main className='relative pt-[11.8rem]'>
<main
className='relative pt-[11.8rem]'
role="main"
aria-label="๋ณด๋“œ ์ง€๋„ ํŽ˜์ด์ง€"
>
<Boardgame />
</main>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/pages/main/HiddenReward.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const HiddenReward = () => {
overflow-hidden
cursor-pointer
'
role="main"
aria-label="ํžˆ๋“  ๋ฆฌ์›Œ๋“œ ํš๋“ ํŽ˜์ด์ง€"
onClick={() =>
router.push({
pathname: '/main/PostCard',
Expand Down
8 changes: 7 additions & 1 deletion src/pages/main/Node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ const Board = () => {
onClick={() => router.back()}
/>

<main className='relative pt-[14.3rem] gap-[1.2rem] flex flex-col '>
<main
className='relative pt-[14.3rem] gap-[1.2rem] flex flex-col '
role="main"
aria-label={`${label ? label : '๋…ธ๋“œ'} ์ƒ์„ธ ํŽ˜์ด์ง€`}
>
<section className='relative w-full'>
<Image
src='/assets/board.svg'
Expand All @@ -31,6 +35,7 @@ const Board = () => {
/>

<button
aria-label={isStamp ? '์Šคํƒฌํ”„ ํš๋“ ์™„๋ฃŒ' : '์Šคํƒฌํ”„ ์ฐ๊ธฐ'}
className={cn('absolute bottom-0 right-0', isStamp && 'p-[2.5rem]')}
onClick={
!isStamp
Expand All @@ -50,6 +55,7 @@ const Board = () => {
name={isStamp ? 'Stamp' : 'PressStamp'}
color={isStamp ? 'pink-400' : 'gray-50'}
size={isStamp ? 100 : 160}
aria-hidden="true"
/>
</button>
</section>
Expand Down
8 changes: 6 additions & 2 deletions src/pages/main/PostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const PostCard = () => {

return (
<div
role="main"
aria-label="์—ฝ์„œ ํš๋“ ํŽ˜์ด์ง€"
className='
relative w-full h-[100vh] px-[2.4rem]
bg-gradient-to-b from-pink-100 to-white
Expand All @@ -30,14 +32,16 @@ const PostCard = () => {
<button
className='flex items-center justify-center w-[4.8rem] h-[4.8rem]'
onClick={handleSave}
aria-label="์—ฝ์„œ ์ด๋ฏธ์ง€ ์ €์žฅ"
>
<Icon name='Save' color='gray-400' size={28} />
<Icon name='Save' color='gray-400' size={28} aria-hidden="true" />
</button>
<button
className='flex items-center justify-center w-[4.8rem] h-[4.8rem]'
onClick={handleShare}
aria-label="์—ฝ์„œ ๊ณต์œ ํ•˜๊ธฐ"
>
<Icon name='Export' color='gray-400' size={28} />
<Icon name='Export' color='gray-400' size={28} aria-hidden="true" />
</button>
</div>

Expand Down
52 changes: 39 additions & 13 deletions src/pages/main/components/board/Boardgame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,70 @@ import { useRouter } from 'next/router';

const Boardgame = () => {
const router = useRouter();

const handleCellClick = (label: string) => {
// TODO : ๋กœ๊ทธ์ธ ์—ฌ๋ถ€ ์ฒดํฌ
router.push({
pathname: '/main/Node',
query: { label },
});
};

return (
<div className='relative w-full h-full bg-[#46d1cd] overflow-hidden'>
<div
className="relative w-full h-full bg-[#46d1cd] overflow-hidden"
role="application"
aria-label="๋ณด๋“œ๊ฒŒ์ž„ ํ™”๋ฉด"
>
<Image
src='/assets/background_.svg'
alt='board background'
src="/assets/background_.svg"
alt=""
width={402}
height={755}
className='w-full h-full object-cover'
className="w-full h-full object-cover"
priority
aria-hidden="true"
/>

<div
className='
className="
absolute top-0 left-0
w-full h-full
grid grid-cols-4 grid-rows-8 gap-0
px-[2rem] pb-[1.7rem]
'
"
role="grid"
aria-label="ํƒํ—˜ ๊ฐ€๋Šฅํ•œ ๋ช…์†Œ ๋ชฉ๋ก"
>
{boardData.map((row, r) =>
row.map((cell, c) => {
const key = `cell-${r}-${c}`;

if (!cell.active) {
return <div key={key} className='bg-transparent' />;
return (
<div
key={key}
className="bg-transparent"
aria-hidden="true" // ๋น„ํ™œ์„ฑ ์…€์€ ๋‚ญ๋… ์ œ์™ธ
/>
);
}

return (
<div
key={key}
role="button"
tabIndex={0}
aria-label={cell.label ? `${cell.label} ๋ช…์†Œ๋กœ ์ด๋™` : '๋ช…์†Œ๋กœ ์ด๋™'}
onClick={() => {
// TODO : ๋กœ๊ทธ์ธ ์—ฌ๋ถ€ ์ฒดํฌ
router.push({
pathname: '/main/Node',
query: { label: cell.label },
});
if (cell.label) handleCellClick(cell.label);
}}
onKeyDown={(e) => {
if ((e.key === 'Enter' || e.key === ' ') && cell.label) {
handleCellClick(cell.label);
}
}}
></div>
/>
);
}),
)}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/main/components/stampBoard/Progress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const Progress = ({ className, value, ...props }: ProgressProps) => {
)}
value={progressPercent}
max={100}
aria-label="์ง„ํ–‰๋ฅ "
aria-valuetext={`${Math.round(progressPercent)}% ์™„๋ฃŒ๋จ`}
{...props}
>
<ProgressPrimitive.Indicator
Expand Down
3 changes: 2 additions & 1 deletion src/pages/main/components/stampBoard/Stamp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ const Stamp = ({ index, acquired, className }: StampProps) => {
if (acquired) {
return (
<div
role="img"
aria-label={`${index + 1}๋ฒˆ์งธ ์Šคํƒฌํ”„ ${acquired ? 'ํš๋“' : '๋ฏธํš๋“'}`}
className={cn(
'flex items-center justify-center w-[2.8rem] h-[2.8rem]',
className,
)}
aria-label={`${index + 1}๋ฒˆ์งธ ์Šคํƒฌํ”„ ํš๋“`}
>
<Icon name='Stamp' size={28} color='pink-400' aria-hidden />
</div>
Expand Down
Loading
Loading