Skip to content

docs: replace image with copyable code block in submit-button.md #207

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
23 changes: 19 additions & 4 deletions fundamentals/code-quality/code/examples/submit-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,26 @@ function SubmitButton() {
`<SubmitButton />` ์ปดํฌ๋„ŒํŠธ์—์„œ๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋Š” 2๊ฐ€์ง€์˜ ๊ถŒํ•œ ์ƒํƒœ๋ฅผ ํ•˜๋‚˜์˜ ์ปดํฌ๋„ŒํŠธ ์•ˆ์—์„œ ํ•œ ๋ฒˆ์— ์ฒ˜๋ฆฌํ•˜๊ณ  ์žˆ์–ด์š”.
๊ทธ๋ž˜์„œ ์ฝ”๋“œ๋ฅผ ์ฝ๋Š” ์‚ฌ๋žŒ์ด ํ•œ ๋ฒˆ์— ๊ณ ๋ คํ•ด์•ผ ํ•˜๋Š” ๋งฅ๋ฝ์ด ๋งŽ์•„์š”.

์˜ˆ๋ฅผ ๋“ค์–ด, ๋‹ค์Œ ์ฝ”๋“œ์—์„œ ํŒŒ๋ž€์ƒ‰์€ ์‚ฌ์šฉ์ž๊ฐ€ ๋ณด๊ธฐ ์ „์šฉ ๊ถŒํ•œ(`'viewer'`)์„ ๊ฐ€์ง€๊ณ  ์žˆ์„ ๋•Œ, ๋นจ๊ฐ„์ƒ‰์€ ์ผ๋ฐ˜ ์‚ฌ์šฉ์ž์ผ ๋•Œ ์‹คํ–‰๋˜๋Š” ์ฝ”๋“œ์˜ˆ์š”.
๋™์‹œ์— ์‹คํ–‰๋˜์ง€ ์•Š๋Š” ์ฝ”๋“œ๊ฐ€ ๊ต์ฐจ๋˜์–ด์„œ ๋‚˜ํƒ€๋‚˜์„œ ์ฝ”๋“œ๋ฅผ ์ดํ•ดํ•  ๋•Œ ๋ถ€๋‹ด์„ ์ค˜์š”.
์˜ˆ๋ฅผ ๋“ค์–ด, ๋‹ค์Œ ์ฝ”๋“œ๋Š” ์ผ๋ฐ˜ ์‚ฌ์šฉ์ž์ผ ๋•Œ๋งŒ ์‹คํ–‰๋˜๋Š” ์ฝ”๋“œ์˜ˆ์š”. ๋™์‹œ์— ์‹คํ–‰๋˜์ง€ ์•Š๋Š” ์ฝ”๋“œ๊ฐ€ ๊ต์ฐจ๋˜์–ด ๋‚˜ํƒ€๋‚˜์„œ ์ฝ”๋“œ๋ฅผ ์ดํ•ดํ•  ๋•Œ ๋ถ€๋‹ด์„ ์ค˜์š”.

![](../../images/examples/submit-button.png){.light-only}
![](../../images/examples/submit-button-dark.png){.dark-only}
```typescript 8,14
function SubmitButton() {
const isViewer = useRole() === "viewer";

useEffect(() => {
if (isViewer) {
return;
}
showButtonAnimation();
}, [isViewer]);

return isViewer ? (
<TextButton disabled>Submit</TextButton>
) : (
<Button type="submit">Submit</Button>
);
}
```

## โœ๏ธ ๊ฐœ์„ ํ•ด๋ณด๊ธฐ

Expand Down
20 changes: 18 additions & 2 deletions fundamentals/code-quality/en/code/examples/submit-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,24 @@ As a result, there are too many contexts for the reader to consider at once.
For example, in the following code, the blue parts are executed when the user has read-only permissions (`'viewer'`), while the red parts are executed for regular users.
Intermixed code that doesn't execute simultaneously creates confusion and makes it harder to understand the logic.

![](../../../images/examples/submit-button.png){.light-only}
![](../../../images/examples/submit-button-dark.png){.dark-only}
```typescript 8,14
function SubmitButton() {
const isViewer = useRole() === "viewer";

useEffect(() => {
if (isViewer) {
return;
}
showButtonAnimation();
}, [isViewer]);

return isViewer ? (
<TextButton disabled>Submit</TextButton>
) : (
<Button type="submit">Submit</Button>
);
}
```

## โœ๏ธ Work on Improving

Expand Down
Binary file not shown.
Binary file not shown.
20 changes: 18 additions & 2 deletions fundamentals/code-quality/ja/code/examples/submit-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,24 @@ function SubmitButton() {

ไพ‹ใˆใฐใ€ๆฌกใฎใ‚ณใƒผใƒ‰ใง้’่‰ฒใฎ้ƒจๅˆ†ใฏใƒฆใƒผใ‚ถใƒผใŒ้–ฒ่ฆงๅฐ‚็”จๆจฉ้™๏ผˆ`'viewer'`๏ผ‰ใ‚’ๆŒใฃใฆใ„ใ‚‹ใจใใซๅฎŸ่กŒใ•ใ‚Œใ‚‹ใ‚ณใƒผใƒ‰ใงใ€่ตค่‰ฒใฎ้ƒจๅˆ†ใฏไธ€่ˆฌใƒฆใƒผใ‚ถใƒผใฎๅ ดๅˆใซๅฎŸ่กŒใ•ใ‚Œใ‚‹ใ‚ณใƒผใƒ‰ใงใ™ใ€‚ๅŒๆ™‚ใซๅฎŸ่กŒใ•ใ‚Œใชใ„ใ‚ณใƒผใƒ‰ใŒไบคๅทฎใ—ใฆ็พใ‚Œใ‚‹ใŸใ‚ใ€ใ‚ณใƒผใƒ‰ใ‚’็†่งฃใ™ใ‚‹ใฎใŒ้›ฃใ—ใใชใฃใฆใ—ใพใฃใฆใ„ใพใ™ใ€‚

![](../../../images/examples/submit-button.png){.light-only}
![](../../../images/examples/submit-button-dark.png){.dark-only}
```typescript 8,14
function SubmitButton() {
const isViewer = useRole() === "viewer";

useEffect(() => {
if (isViewer) {
return;
}
showButtonAnimation();
}, [isViewer]);

return isViewer ? (
<TextButton disabled>Submit</TextButton>
) : (
<Button type="submit">Submit</Button>
);
}
```

## โœ๏ธ ใƒชใƒ•ใ‚กใ‚ฏใ‚ฟใƒชใƒณใ‚ฐใ—ใฆใฟใ‚‹

Expand Down
20 changes: 18 additions & 2 deletions fundamentals/code-quality/zh-hans/code/examples/submit-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,24 @@ function SubmitButton() {
ไพ‹ๅฆ‚๏ผŒๅœจไธ‹้ข็š„ไปฃ็ ไธญ๏ผŒ่“่‰ฒ้ƒจๅˆ†่กจ็คบๅฝ“็”จๆˆทๅ…ทๆœ‰ไป…ๆŸฅ็œ‹ๆƒ้™๏ผˆ`'viewer'`๏ผ‰ๆ—ถ่ฟ่กŒ็š„ไปฃ็ ๏ผŒ็บข่‰ฒ้ƒจๅˆ†่กจ็คบๅฝ“็”จๆˆทๆ˜ฏๆ™ฎ้€š็”จๆˆทๆ—ถ่ฟ่กŒ็š„ไปฃ็ ใ€‚
็”ฑไบŽไธๅŒๆ—ถ่ฟ่กŒ็š„ไปฃ็ ไบค็ป‡ๅœจไธ€่ตท๏ผŒ็†่งฃไปฃ็ ๆ—ถไบง็”Ÿ่ดŸๆ‹…ใ€‚

![](../../../images/examples/submit-button.png){.light-only}
![](../../../images/examples/submit-button-dark.png){.dark-only}
```typescript 8,14
function SubmitButton() {
const isViewer = useRole() === "viewer";

useEffect(() => {
if (isViewer) {
return;
}
showButtonAnimation();
}, [isViewer]);

return isViewer ? (
<TextButton disabled>Submit</TextButton>
) : (
<Button type="submit">Submit</Button>
);
}
```

## โœ๏ธ ๅฐ่ฏ•ๆ”นๅ–„

Expand Down