-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Leeseunghwan7305/tmdghks7305
Tmdghks7305
- Loading branch information
Showing
19 changed files
with
306 additions
and
452 deletions.
There are no files selected for viewing
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,24 @@ | ||
# Workflow name | ||
name: "Chromatic Deployment" | ||
|
||
# Event for the workflow | ||
on: push | ||
|
||
# List of jobs | ||
jobs: | ||
test: | ||
# Operating System | ||
runs-on: ubuntu-latest | ||
# Job steps | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: npm | ||
#👇 Adds Chromatic as a step in the workflow | ||
- uses: chromaui/action@v1 | ||
# Options required for Chromatic's GitHub Action | ||
with: | ||
#👇 Chromatic projectToken, see https://storybook.js.org/tutorials/intro-to-storybook/react/en/deploy/ to obtain it | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 @@ | ||
// Nav.stories.tsx | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import Nav from "./Nav"; | ||
import { fn } from "@storybook/test"; | ||
|
||
const meta = { | ||
title: "Common/Nav", | ||
component: Nav, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
tages: ["autodocs"], | ||
// decorators: [ | ||
// (Story) => ( | ||
// <div | ||
// style={{ | ||
// position: "absolute", | ||
// top: 0, | ||
// left: 0, | ||
// width: "100%", | ||
// }} | ||
// > | ||
// <Story /> | ||
// </div> | ||
// ), | ||
// ], | ||
args: { onClick: fn() }, | ||
} as Meta<typeof Nav>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = {}; |
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,89 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import { fn } from "@storybook/test"; | ||
import DropBox from "./DropBox"; | ||
|
||
const meta = { | ||
title: "Components/DropBox", | ||
component: DropBox, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
tags: ["autodocs"], | ||
// argTypes: { | ||
// type: "추천검색어", | ||
// }, | ||
args: { onClick: fn() }, | ||
decorators: [ | ||
(Story) => ( | ||
<div | ||
style={{ | ||
position: "absolute", | ||
top: 0, | ||
left: 0, | ||
width: "800px", | ||
}} | ||
> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
} as Meta<typeof DropBox>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const RecommendedSearch: Story = { | ||
args: { | ||
type: "추천검색어", | ||
searchLists: [ | ||
{ name: "Search Term 1", id: 1 }, | ||
{ name: "Search Term 2", id: 2 }, | ||
{ name: "Search Term 3", id: 3 }, | ||
], | ||
selectedIndex: -1, | ||
}, | ||
}; | ||
|
||
export const RecentSearch: Story = { | ||
args: { | ||
type: "최근검색어", | ||
searchLists: [ | ||
{ name: "Search Term 1", id: 1 }, | ||
{ name: "Search Term 2", id: 2 }, | ||
{ name: "Search Term 3", id: 3 }, | ||
], | ||
selectedIndex: -1, | ||
}, | ||
}; | ||
|
||
// import React, { useState } from "react"; | ||
// import { Story } from "@storybook/react"; | ||
// import DropBox, { DropBoxProps } from "./DropBox"; | ||
|
||
// export default { | ||
// title: "Components/DropBox", | ||
// component: DropBox, | ||
// }; | ||
|
||
// const Template: Story<DropBoxProps> = (args) => { | ||
// const [value, setValue] = useState(""); | ||
// return <DropBox {...args} value={value} setValue={setValue} />; | ||
// }; | ||
|
||
// export const RecommendedSearch = Template.bind({}); | ||
// RecommendedSearch.args = { | ||
// type: "추천검색어", | ||
// searchLists: [ | ||
// { name: "Search Term 1", id: 1 }, | ||
// { name: "Search Term 2", id: 2 }, | ||
// { name: "Search Term 3", id: 3 }, | ||
// ], | ||
// selectedIndex: -1, | ||
// }; | ||
|
||
// export const RecentSearch = Template.bind({}); | ||
// RecentSearch.args = { | ||
// type: "최근검색어", | ||
// searchLists: [], | ||
// selectedIndex: -1, | ||
// }; |
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,33 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import NoResult from "./NoResult"; | ||
|
||
const meta = { | ||
title: "Components/NoResult", | ||
component: NoResult, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
tags: ["autodocs"], | ||
decorators: [ | ||
(Story) => ( | ||
<div | ||
style={{ | ||
width: "1000px", | ||
}} | ||
> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
} as Meta<typeof NoResult>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
title: "검색결과가 없습니다.", | ||
description: "검색어를 다시 확인해주세요.", | ||
}, | ||
}; |
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,58 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import ResultList from "./ResultList"; | ||
import { ResultListType } from "@/src/types/searchResult"; | ||
import { fn } from "@storybook/test"; | ||
|
||
const meta = { | ||
title: "Components/ResultList", | ||
component: ResultList, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
tags: ["autodocs"], | ||
args: { onClick: fn() }, | ||
decorators: [ | ||
(Story) => ( | ||
<div | ||
style={{ | ||
width: "1000px", | ||
}} | ||
> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
} as Meta<typeof ResultList>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
const sampleResults: ResultListType = { | ||
from_type: 1, | ||
url: "http://example.com", | ||
id: 123, | ||
ct_id: "NCT123456", | ||
locations: [{ city: "San Francisco" }], | ||
phases: ["Phase 1", "Phase 2"], | ||
minimum_age_display: "18 Years", | ||
maximum_age_display: "65 Years", | ||
title: "Study of Something Important", | ||
start_date: "2021-01-01", | ||
completion_date: "2023-01-01", | ||
lead_sponsor_name: "Big Pharma Inc.", | ||
brief_summary: "This study investigates something important.", | ||
gender: "All", | ||
is_sponsor: true, | ||
survey_id: null, | ||
is_new: true, | ||
created_at: "2020-12-31", | ||
}; | ||
|
||
export const Basic: Story = { | ||
args: { | ||
searchResult: sampleResults, | ||
toggleFavorites: () => {}, | ||
location: "main", | ||
}, | ||
}; |
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,61 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import SearchBar from "./SearchBar"; | ||
import { useState } from "react"; | ||
import { fn, userEvent, within } from "@storybook/test"; | ||
|
||
const meta = { | ||
title: "Components/SearchBar", | ||
component: SearchBar, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
tags: ["autodocs"], | ||
decorators: [ | ||
(Story) => ( | ||
<div | ||
style={{ | ||
width: "800px", | ||
}} | ||
> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
args: { onClick: fn() }, | ||
} as Meta<typeof SearchBar>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
const Render = (args: typeof meta) => { | ||
const [value, setValue] = useState(""); | ||
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
setValue(e.target.value); | ||
}; | ||
const refetch = () => {}; | ||
|
||
return ( | ||
<SearchBar | ||
{...args} | ||
value={value} | ||
setValue={setValue} | ||
onChange={onChange} | ||
refetch={refetch} | ||
/> | ||
); | ||
}; | ||
|
||
export const Basic: Story = { | ||
render: () => <Render />, | ||
play: async ({ canvasElement }) => { | ||
const canvas = within(canvasElement); | ||
|
||
const input = canvas.getAllByRole("textbox")[0]; | ||
|
||
await userEvent.type(input, "갑상선", { | ||
delay: 100, | ||
}); | ||
await userEvent.click(input); | ||
}, | ||
}; |
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
Oops, something went wrong.