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

[Feat] 쇼케이스 페이지 club profile card 구현 #52

Merged
merged 17 commits into from
Jul 9, 2024
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { css } from '@emotion/react';

import { theme } from '@/common/style/theme/theme';

export const imageStyle = css({
width: '100%',
height: '14rem',

borderRadius: '16px 16px 0px 0px',
});

export const descriptionStyle = css({
display: 'flex',
flexDirection: 'column',
gap: '0.6rem',

padding: '1.6rem',
});

export const titleStyle = css({
...theme.heading.heading06,
});

export const detailStyle = css({
height: '3.4rem',

...theme.text.body07,

overflow: 'hidden',
});
26 changes: 26 additions & 0 deletions src/page/showcase/component/ClubProfileCard/ClubProfileCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {
descriptionStyle,
detailStyle,
imageStyle,
titleStyle,
} from '@/page/showcase/component/ClubProfileCard/ClubProfileCard.style';

interface ClubProfileCardProps {
title: string;
detail: string;
Image: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

카드에서 img로 활용할 녀석들은 svg가 아니라 png 혹은 jpg가 될 것 같아서 이렇게 svgr 컴포넌트를 넘겨주는게 아니라 imgUrl을 넘겨주도록 구현하는게 맞을 것 같아요 !

prop으로 이미지 url을 가져오고, img 태그를 활용하여 src 속성에 대입해주는 것이 올바를 것 같습니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

img 태그를 활용하는 과정에서, 최상위 컨테이너 요소를 width 100%를 적용한 후 그 안에서 img태그는 width 백퍼, object-fit 적용, aspect-ratio를 활용한 레이아웃 시프트 방지 등을 적용하면 좋을 것 같습니다.

Copy link
Member

Choose a reason for hiding this comment

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

맞네요...svg로 받아오는 걸 체크 못했는데 역시 주용님 !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵! 적용했습니다 ~ 👍


const ClubProfileCard = ({ title, detail, Image }: ClubProfileCardProps) => {
return (
<>
<Image css={imageStyle} />
<div css={descriptionStyle}>
<p css={titleStyle}>{title}</p>
<p css={detailStyle}>{detail}</p>
</div>
</>
);
};

export default ClubProfileCard;
16 changes: 16 additions & 0 deletions src/page/showcase/constant/empty.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 2 additions & 6 deletions src/story/page/archiving/DaySection.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const meta = {
},
args: {
day: 1,
onDayClick: () => {},
isClicked: false,
},
argTypes: {
day: {
Expand All @@ -23,8 +23,4 @@ const meta = {
export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
args: {
onDayClick: () => {},
},
};
export const Default: Story = {};
22 changes: 22 additions & 0 deletions src/story/page/showcase/ClubProfileCard.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import ClubProfileCard from '@/page/showcase/component/ClubProfileCard/ClubProfileCard';
import Image from '@/page/showcase/constant/empty.svg?react';
import type { Meta, StoryObj } from '@storybook/react';

const meta = {
title: 'Page/ClubProfileCard',
component: ClubProfileCard,
parameters: {
layout: 'centered',
},
args: {
title: 'Tiki 티키',
detail: '안녕하세요 티키입니다. 저희는 멋진 웹사이트를 제작합니다.',
Image: Image,
},
argTypes: {},
Copy link
Member

Choose a reason for hiding this comment

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

  argTypes: {
    title: {
      control: {
        type: 'text',
      },
    },
    detail: {
      control: {
        type: 'text',
      },
    },
  },

요런식으로 컨트롤 타입도 지정해주면 스토리북을 더 잘 활용할 수 있을 것 같아요 !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오호라 감사합니다!!

} satisfies Meta<typeof ClubProfileCard>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {};