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/quiz 19 ] #27

Merged
merged 29 commits into from
Jun 7, 2024
Merged

[ Feature/quiz 19 ] #27

merged 29 commits into from
Jun 7, 2024

Conversation

Happhee
Copy link
Collaborator

@Happhee Happhee commented Jun 7, 2024

๐Ÿ”ฅ Related Issues

resolve #19
close #19

๐Ÿ’œ ์ž‘์—… ๋‚ด์šฉ

  • quiz, article ํŽ˜์ด์ง€์˜ ๊ณตํ†ต ํ—ค๋” topbar ๊ตฌํ˜„
  • quiz ํŽ˜์ด์ง€์˜ ๋ฒ„ํŠผ ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„
  • quiz ํŽ˜์ด์ง€์˜ ๋ฒ„ํŠผ ์ปดํฌ๋„ŒํŠธ test ๋ฐ story ์ž‘์„ฑ

โœ… PR Point

main.ts

  • storybook์—์„œ svg ํŒŒ์ผ์„ ์ฝ๊ธฐ ์œ„ํ•ด ์›นํŒฉ ์„ค์ •์„ ์ง„ํ–‰
 webpackFinal: async (config) => {
    if (!config.resolve || !config.module || !config.module.rules) {
      throw new Error("Webpack Error");
    }

    const imageRule = config.module?.rules?.find((rule) => {
      const test = (rule as { test: RegExp }).test;

      if (!test) {
        return false;
      }

      return test.test(".svg");
    }) as { [key: string]: any };

    imageRule.exclude = /\.svg$/;

    config.module?.rules?.push({
      test: /\.svg$/,
      use: ["@svgr/webpack"],
    });

    return config;
  },

custom.d.ts

svgํŒŒ์ผ์— ๋Œ€ํ•ด ํƒ€์ž…์„ ์ฝ์„ ์ˆ˜ ์žˆ๋„๋ก ์ •์˜ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

import { SVGSVGElement } from "react";

declare global {
  module "*.svg" {
    const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>;
    export default ReactComponent;
  }
}

quiz/components/AnswerContextButton

ํ•ด๋‹น ๋ฒ„ํŠผ ํƒ€์ž…์€ ์ด 3๊ฐ€์ง€ ์ž…๋‹ˆ๋‹ค.

  1. ์ •๋‹ต ์„ ํƒ์ „
  2. ์ •๋‹ต ์„ ํƒ ํ›„ ์ œ์ถœ์ „
  3. ์ •๋‹ต ์ œ์ถœ ์™„๋ฃŒ

์ด์— ๋”ฐ๋ฅธ test์ฝ”๋“œ์™€ story๋ฅผ ๊ตฌํ˜„ํ•˜์—ฌ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ๋ฐ ui ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

common/conponents/Topbar

quiz, article ํŽ˜์ด์ง€์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ณตํ†ต topbar ์ปดํฌ๋„ŒํŠธ ์ž…๋‹ˆ๋‹ค..!

  • ๋น„์ฆˆ๋‹ˆ์Šค๋กœ์ง์€ ์—†์–ด์„œ story ๋งŒ ํ…Œ์ŠคํŠธ๋ฅผ ํ–ˆ์Šต๋‹ˆ๋‹ค..!

๐Ÿ˜ก Trouble Shooting

๐Ÿ‘€ ์Šคํฌ๋ฆฐ์ƒท / GIF / ๋งํฌ

image

๐Ÿ“š Reference

Happhee added 21 commits June 5, 2024 15:51
expect(screen.getByText("๋‹ค์Œ ๋ฌธ์ œ ํ’€๊ธฐ")).toBeInTheDocument();
expect(screen.getByRole("button")).toHaveClass("bg-text-black");
});
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ํ€ด์ฆˆ ํ’€์ด ์ผ€์ด์Šค์— ๋”ฐ๋ฅธ ๋ฒ„ํŠผ ํ…Œ์ŠคํŠธ ํŒŒ์ผ์ž…๋‹ˆ๋‹ค.

Copy link
Collaborator

Choose a reason for hiding this comment

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

์˜ค์˜ค ์ด๊ฑฐ ์ฐธ๊ณ ํ•ด์„œ ์ €๋„ Test ์‚ฌ์šฉํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค ๐Ÿ’ฏ

Copy link
Collaborator

Choose a reason for hiding this comment

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

storybook ์—์„œ queryClient ์‚ฌ์šฉํ•˜๋Š” ๋ถ€๋ถ„์ด๊ตฐ์šฉ!! ์ข‹์Šต๋‹ˆ๋‹ค ๐Ÿ‘

Copy link
Collaborator

Choose a reason for hiding this comment

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

์•„์ง TopBar ์— ๋‹ค๋ฅธ UI ์ ์ธ ์š”์†Œ๊ฐ€ ์—†๊ตฐ์šฉ!
๋‚˜์ค‘์— ๊ฐ™์ด ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋ฉด์€ ์š” TopBar ์‚ฌ์šฉํ•ด์„œ ๊ตฌํ˜„ ํ•˜๋ฉด ๋˜๊ฒ ๋„ค์š”!!

states: { answer, isSubmit },
} = useContext(QuizContext);

const result = isSubmit ? "๋‹ค์Œ ๋ฌธ์ œ ํ’€๊ธฐ" : "์ •๋‹ต ์ œ์ถœํ•˜๊ธฐ";
Copy link
Collaborator

Choose a reason for hiding this comment

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

"๋‹ค์Œ ๋ฌธ์ œ ํ’€๊ธฐ", "์ •๋‹ต ์ œ์ถœํ•˜๊ธฐ" ์š”๋Ÿฐ ๋‚ด์šฉ๋“ค์€ constants ์— ๋„ฃ์–ด์„œ ์ €๋Š” ์ƒ์ˆ˜๋กœ ์ฒ˜๋ฆฌ ํ–ˆ๋Š”๋ฐ ์–ด๋–จ๊นŒ์šฉ?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

์ƒ์ˆ˜์ฒ˜๋ฆฌ ๋ฐ˜์˜ํ•œ commit ์ž…๋‹ˆ๋‹ค!! ์˜๊ฒฌ๊ฐ์‚ฌํ•ด์š”!


export default function TagList() {
return <div></div>;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

์–œ ๋ฌด์‹œํ•ด์ฃผ์„ธ์š” ใ… .ใ… ใ… .

@Happhee Happhee merged commit 0f1a300 into develop Jun 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants