Skip to content

Commit f452304

Browse files
TIL > 프로필 페이지의 스크롤과 content style에 대한 버그 해결 (#486)
* feat: Grid style을 반응형으로 구현 * fix: 활동 content에 gap 적용 * fix: 월간 기록 content가 영역을 벗어나는 버그 해결 * refactor: 연산시마다 재선언되는 상수 개선 * chore: fixme 작성 * [autofix.ci] apply automated fixes * refactor: grid 최대 넓이 적용 --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent ca9c7b7 commit f452304

File tree

11 files changed

+140
-173
lines changed

11 files changed

+140
-173
lines changed

fundamentals/a11y/ja/alt-text/image-alt.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,23 @@
100100

101101
代替テキストは、その画像が伝える意味を正確に説明するべきです。あいまいな言葉や抽象的な表現は、ユーザーが画像から得るべき情報を理解しづらくします。
102102

103-
| 区分 || 説明 |
104-
| ---------- | -------------------- | ------------------------------------------------------ |
105-
| ❌ 悪い例 | "アイコン" | アイコンの用途や機能に関する情報がありません。 |
103+
| 区分 | | 説明 |
104+
| --------- | -------------------- | ------------------------------------------------ |
105+
| ❌ 悪い例 | "アイコン" | アイコンの用途や機能に関する情報がありません。 |
106106
| ✅ 良い例 | "検索" | アイコンが何を意味するかを明確に伝えます。 |
107-
| ❌ 悪い例 | "グラフ" | このグラフが何を示すのか分かりません。 |
107+
| ❌ 悪い例 | "グラフ" | このグラフが何を示すのか分かりません。 |
108108
| ✅ 良い例 | "2023年の売上グラフ" | グラフがどのデータを示すかを具体的に説明します。 |
109109

110110
### 2. 不要な語を省く
111111

112112
代替テキストはスクリーンリーダーが読むためのものなので、「アイコン」「ボタン」のような語はたいてい冗長です。スクリーンリーダーは、画像を含む要素の役割(ボタンなど)を既に理解しているため、代替テキストでは情報だけを簡潔に伝えるのが望ましいです。
113113

114-
| 区分 || 説明 |
115-
| ---------- | ------------- | --------------------------------------------------------------------------------------- |
116-
| ✅ 良い例 | "検索" | |
114+
| 区分 | | 説明 |
115+
| --------- | -------------- | -------------------------------------------------------------------------------- |
116+
| ✅ 良い例 | "検索" | |
117117
| ❌ 悪い例 | "検索アイコン" | スクリーンリーダーは「検索、ボタン」と読むため、「アイコン」は重複して不要です。 |
118-
| ✅ 良い例 | "閉じる" | |
119-
| ❌ 悪い例 | "閉じるボタン" | ボタンという役割は既に明らかなので、テキストでは省略したほうがすっきりします。 |
118+
| ✅ 良い例 | "閉じる" | |
119+
| ❌ 悪い例 | "閉じるボタン" | ボタンという役割は既に明らかなので、テキストでは省略したほうがすっきりします。 |
120120

121121
### 3. 画像の目的と文脈を考慮する
122122

fundamentals/a11y/ja/eslint/design-system.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,4 @@ export default [
192192

193193
---
194194

195-
このほかにも、デザインシステムにはさまざまなコンポーネントや prop パターンが存在します。詳細は[eslint-plugin-jsx-a11y 공식 문서](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)のsettingsとrulesのオプションを参照し、要件に合わせてカスタマイズしてください。
195+
このほかにも、デザインシステムにはさまざまなコンポーネントや prop パターンが存在します。詳細は[eslint-plugin-jsx-a11y 공식 문서](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)のsettingsとrulesのオプションを参照し、要件に合わせてカスタマイズしてください。

fundamentals/a11y/ja/playground.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ PCではマウスのクリックとドラッグでタッチ操作を代替でき
3030
<ScreenReaderExperience
3131
url="https://service.toss.im/accessibility/screen-reader-experience"
3232
title="スクリーンリーダー体験ページへ"
33-
/>
33+
/>

fundamentals/a11y/ja/predictability/fake-button.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
```jsx
2020
<div class="button-style" style="cursor: pointer" onclick="handleAnything()">
21-
お問い合わせ
21+
お問い合わせ
2222
</div>
2323
```
2424

fundamentals/a11y/ja/structure/button-inside-button.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
次のように`<a>`タグの中に`<button>`を出力するコンポーネントを入れるのは間違いです。HTMLでは、インタラクティブな要素の中に別のインタラクティブ要素を入れることは許可されていないためです[^1].この構造ではアクセシビリティの問題が発生し、ブラウザで予期しない動作が起きる可能性があります。
1010

11-
[^1]: https://www.w3.org/TR/2011/WD-html5-20110405/text-level-semantics.html#the-a-element
12-
のContent model項目を参考にしてください。
11+
[^1]:
12+
https://www.w3.org/TR/2011/WD-html5-20110405/text-level-semantics.html#the-a-element
13+
のContent model項目を参考にしてください。
1314

1415
```jsx
1516
<a href="/go-to">
@@ -109,20 +110,20 @@ UIの構成上、ボタンのように見えるカードの中に別のボタン
109110

110111
以下の要素はいずれもインタラクティブ要素です。これらのいずれかを含む要素の中に、さらに別のインタラクティブ要素を入れてはいけません。
111112

112-
| 요소 | 조건 |
113-
| ------------ | ------------------------------------ |
114-
| `<a>` | - |
115-
| `<audio>` | controls属性がある場合 |
116-
| `<button>` | - |
117-
| `<details>` | - |
118-
| `<embed>` | - |
119-
| `<iframe>` | - |
120-
| `<img>` | usemap属性がある場合 |
113+
| 요소 | 조건 |
114+
| ------------ | ---------------------------------- |
115+
| `<a>` | - |
116+
| `<audio>` | controls属性がある場合 |
117+
| `<button>` | - |
118+
| `<details>` | - |
119+
| `<embed>` | - |
120+
| `<iframe>` | - |
121+
| `<img>` | usemap属性がある場合 |
121122
| `<input>` | type属性が Hidden state でない場合 |
122-
| `<keygen>` | - |
123-
| `<label>` | - |
124-
| `<menu>` | type属性が toolbar 状態の場合 |
125-
| `<object>` | usemap属性がある場合 |
126-
| `<select>` | - |
127-
| `<textarea>` | - |
128-
| `<video>` | controls属性がある場合 |
123+
| `<keygen>` | - |
124+
| `<label>` | - |
125+
| `<menu>` | type属性が toolbar 状態の場合 |
126+
| `<object>` | usemap属性がある場合 |
127+
| `<select>` | - |
128+
| `<textarea>` | - |
129+
| `<video>` | controls属性がある場合 |

fundamentals/today-i-learned/src/components/features/challenge/MonthlyChallenge.tsx

Lines changed: 61 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -25,54 +25,55 @@ const MONTH_NAMES = [
2525
"12월"
2626
];
2727

28+
const COLORS = [
29+
css({
30+
backgroundColor: "rgba(0, 0, 0, 0.1)",
31+
color: "rgba(0, 0, 0, 0.4)"
32+
}),
33+
css({
34+
backgroundColor: "rgba(188, 233, 233, 0.2)",
35+
color: "#58C7C7"
36+
}),
37+
css({
38+
backgroundColor: "rgba(237, 204, 248, 0.4)",
39+
color: "#DA9BEF"
40+
}),
41+
css({
42+
backgroundColor: "rgba(255, 239, 191, 0.6)",
43+
color: "#FFC342"
44+
}),
45+
css({
46+
backgroundColor: "rgba(255, 212, 214, 0.2)",
47+
color: "#FB8890"
48+
}),
49+
css({
50+
backgroundColor: "rgba(188, 233, 233, 0.2)",
51+
color: "#58C7C7"
52+
}),
53+
css({
54+
backgroundColor: "rgba(188, 233, 233, 0.2)",
55+
color: "#58C7C7"
56+
}),
57+
css({
58+
backgroundColor: "rgba(255, 212, 214, 0.2)",
59+
color: "#FB8890"
60+
}),
61+
css({
62+
backgroundColor: "rgba(255, 239, 191, 0.6)",
63+
color: "#FFC342"
64+
}),
65+
css({
66+
backgroundColor: "rgba(0, 0, 0, 0.1)",
67+
color: "rgba(0, 0, 0, 0.4)"
68+
})
69+
];
70+
2871
function ChallengeDayItem({ day }: { day: ChallengeDay }) {
2972
const getDayStyle = () => {
3073
switch (day.status) {
3174
case "completed":
32-
const colors = [
33-
css({
34-
backgroundColor: "rgba(0, 0, 0, 0.1)",
35-
color: "rgba(0, 0, 0, 0.4)"
36-
}),
37-
css({
38-
backgroundColor: "rgba(188, 233, 233, 0.2)",
39-
color: "#58C7C7"
40-
}),
41-
css({
42-
backgroundColor: "rgba(237, 204, 248, 0.4)",
43-
color: "#DA9BEF"
44-
}),
45-
css({
46-
backgroundColor: "rgba(255, 239, 191, 0.6)",
47-
color: "#FFC342"
48-
}),
49-
css({
50-
backgroundColor: "rgba(255, 212, 214, 0.2)",
51-
color: "#FB8890"
52-
}),
53-
css({
54-
backgroundColor: "rgba(188, 233, 233, 0.2)",
55-
color: "#58C7C7"
56-
}),
57-
css({
58-
backgroundColor: "rgba(188, 233, 233, 0.2)",
59-
color: "#58C7C7"
60-
}),
61-
css({
62-
backgroundColor: "rgba(255, 212, 214, 0.2)",
63-
color: "#FB8890"
64-
}),
65-
css({
66-
backgroundColor: "rgba(255, 239, 191, 0.6)",
67-
color: "#FFC342"
68-
}),
69-
css({
70-
backgroundColor: "rgba(0, 0, 0, 0.1)",
71-
color: "rgba(0, 0, 0, 0.4)"
72-
})
73-
];
74-
const colorIndex = (day.day - 1) % colors.length;
75-
return colors[colorIndex];
75+
const colorIndex = (day.day - 1) % COLORS.length;
76+
return COLORS[colorIndex];
7677
case "posted":
7778
return postedDayStyle;
7879
case "today":
@@ -196,12 +197,6 @@ export function MonthlyChallenge({ challenge }: MonthlyChallengeProps) {
196197
);
197198
}
198199

199-
// 7x5 그리드로 배치 (주단위)
200-
const weeks = [];
201-
for (let i = 0; i < displayData.days.length; i += 7) {
202-
weeks.push(displayData.days.slice(i, i + 7));
203-
}
204-
205200
return (
206201
<div className={challengeContainer}>
207202
<div className={headerSection}>
@@ -210,18 +205,10 @@ export function MonthlyChallenge({ challenge }: MonthlyChallengeProps) {
210205
{displayData.year}{monthName} 한 달 기록
211206
</p>
212207
</div>
213-
<Card variant="bordered" padding="md" className="w-full">
208+
<Card variant="bordered" padding="md" className={cardContainer}>
214209
<div className={cardContent}>
215-
{weeks.map((week, weekIndex) => (
216-
<div key={weekIndex} className={calendarGrid}>
217-
{week.map((day) => (
218-
<ChallengeDayItem key={day.day} day={day} />
219-
))}
220-
{week.length < 7 &&
221-
Array.from({ length: 7 - week.length }).map((_, emptyIndex) => (
222-
<div key={`empty-${emptyIndex}`} className={emptyCell} />
223-
))}
224-
</div>
210+
{displayData.days.map((day) => (
211+
<ChallengeDayItem key={day.day} day={day} />
225212
))}
226213
</div>
227214
</Card>
@@ -233,6 +220,7 @@ export function MonthlyChallenge({ challenge }: MonthlyChallengeProps) {
233220
const challengeContainer = css({
234221
display: "flex",
235222
flexDirection: "column",
223+
padding: "1rem",
236224
gap: "1.5rem"
237225
});
238226

@@ -257,10 +245,14 @@ const subtitle = css({
257245
letterSpacing: "-0.025em"
258246
});
259247

248+
const cardContainer = css({
249+
maxWidth: "32rem"
250+
});
251+
260252
const cardContent = css({
261-
display: "flex",
262-
flexDirection: "column",
263-
gap: "1rem"
253+
display: "grid",
254+
gridTemplateColumns: "repeat(7, 1fr)",
255+
gap: "0.75rem"
264256
});
265257

266258
const calendarGrid = css({
@@ -275,12 +267,14 @@ const dayItemContainer = css({
275267
display: "flex",
276268
flexDirection: "column",
277269
alignItems: "center",
278-
gap: "0.75rem"
270+
gap: "0.5rem"
279271
});
280272

281273
const dayCircle = css({
282-
width: "3.5rem",
283-
height: "3.5rem",
274+
minWidth: "1.5rem",
275+
minHeight: "1.5rem",
276+
width: "100%",
277+
aspectRatio: "1/1",
284278
borderRadius: "50%",
285279
display: "flex",
286280
alignItems: "center",

0 commit comments

Comments
 (0)