-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
427399a
commit ed6e3fd
Showing
5 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/components/ProjectCarousel/ProjectCarousel.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { ProjectCarousel } from './index'; | ||
|
||
const meta: Meta<typeof ProjectCarousel> = { | ||
title: 'components/ProjectCarousel', | ||
component: ProjectCarousel, | ||
args: {}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof ProjectCarousel>; | ||
|
||
export const Primary: Story = { | ||
render: () => <ProjectCarousel />, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
import { ProjectCarouselItem } from '~/components/ProjectCarousel/ProjectCarouselItem'; | ||
import { SectionTitle } from '~/components/SectionTitle'; | ||
import { Swiper } from '~/components/Swiper'; | ||
import { PROJECT_LIST } from '~/constant/project'; | ||
|
||
export function ProjectCarousel() { | ||
return ( | ||
<div css={layoutCss}> | ||
<SectionTitle label="Project" title="프로젝트" /> | ||
<Swiper.Wrapper | ||
spaceBetween={24} | ||
slidesPerView="auto" | ||
loop={true} | ||
autoplay={{ | ||
delay: 0, | ||
}} | ||
speed={1000} | ||
> | ||
{PROJECT_LIST.map(project => ( | ||
<ProjectCarouselItem key={project.title} {...project} /> | ||
))} | ||
</Swiper.Wrapper> | ||
</div> | ||
); | ||
} | ||
|
||
const layoutCss = css` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
overflow: hidden; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Image from 'next/image'; | ||
import { css } from '@emotion/react'; | ||
|
||
import { Swiper } from '~/components/Swiper'; | ||
|
||
interface ProjectCarouselItemProps { | ||
title: string; | ||
subTitle: string; | ||
description: string; | ||
links: Array<{ type: string; href: string }>; | ||
} | ||
|
||
export function ProjectCarouselItem({ title, subTitle }: ProjectCarouselItemProps) { | ||
return ( | ||
<Swiper.Item css={imageCss}> | ||
<Image alt={title} src={`/images/project/${subTitle}/${title}.png`} fill quality={100} /> | ||
</Swiper.Item> | ||
); | ||
} | ||
|
||
ProjectCarouselItem.displayName = 'SwiperSlide'; | ||
|
||
const imageCss = css` | ||
position: relative; | ||
width: 312px; | ||
height: 208px; | ||
object-fit: cover; | ||
object-position: center; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { ProjectCarousel } from './ProjectCarousel'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters