-
Notifications
You must be signed in to change notification settings - Fork 0
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
impl multi prop into select #23
Open
sparcscasio
wants to merge
9
commits into
dev
Choose a base branch
from
22-impl-multi-prop-into-select
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2d7d1c2
feat: impl multi prop into select
sparcscasio 41f3cc5
chore: delete comment
sparcscasio 1f46603
chore: fix file directory
sparcscasio 53a1655
chore: fix file directory
sparcscasio f864e0c
feat: add example page
sparcscasio ab934c9
chore: delete example file
sparcscasio e8f53d5
chore: resolve conflicts
sparcscasio f8e4cac
chore: resolve errors
sparcscasio 20af66f
chore: resolve errors
sparcscasio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,86 @@ | ||
"use client"; | ||
|
||
import Select, { | ||
SelectItem, | ||
} from "@sparcs-students/web/common/components/Select"; | ||
import React, { useState } from "react"; | ||
import styled from "styled-components"; | ||
|
||
const Container = styled.div` | ||
max-width: 600px; | ||
margin: 0 auto; | ||
padding: 20px; | ||
font-family: Arial, sans-serif; | ||
`; | ||
|
||
const Section = styled.div` | ||
margin-bottom: 40px; | ||
`; | ||
|
||
const Header = styled.h1` | ||
font-size: 24px; | ||
margin-bottom: 20px; | ||
`; | ||
|
||
const ExamplePage: React.FC = () => { | ||
const [singleSelected, setSingleSelected] = useState<string>(""); | ||
const [multiSelected, setMultiSelected] = useState<string[]>([]); | ||
const [errorStatus, setErrorStatus] = useState<boolean>(false); | ||
|
||
const singleSelectItems: SelectItem[] = [ | ||
{ label: "Option 1", value: "option1", selectable: true }, | ||
{ label: "Option 2", value: "option2", selectable: true }, | ||
{ label: "Option 3", value: "option3", selectable: true }, | ||
]; | ||
|
||
const multiSelectItems: SelectItem[] = [ | ||
{ label: "Apple", value: "apple", selectable: true }, | ||
{ label: "Banana", value: "banana", selectable: true }, | ||
{ label: "Cherry", value: "cherry", selectable: true }, | ||
{ label: "Grapes", value: "grapes", selectable: true }, | ||
]; | ||
|
||
console.log(errorStatus); | ||
|
||
return ( | ||
<Container> | ||
<Header>Select Component Example</Header> | ||
|
||
{/* 단일 선택 */} | ||
<Section> | ||
<h2>Single Select</h2> | ||
<Select | ||
label="Choose an option" | ||
items={singleSelectItems} | ||
selectedValue={singleSelected} | ||
onSelect={value => setSingleSelected(value as string)} | ||
errorMessage="You must select an option" | ||
setErrorStatus={setErrorStatus} | ||
/> | ||
<p> | ||
<strong>Selected Value:</strong> {singleSelected || "None"} | ||
</p> | ||
</Section> | ||
|
||
{/* 다중 선택 */} | ||
<Section> | ||
<h2>Multi Select</h2> | ||
<Select | ||
label="Select your favorite fruits" | ||
items={multiSelectItems} | ||
selectedValue={multiSelected} | ||
multi | ||
onSelect={value => setMultiSelected(value as string[])} | ||
errorMessage="At least one fruit must be selected" | ||
setErrorStatus={setErrorStatus} | ||
/> | ||
<p> | ||
<strong>Selected Values:</strong>{" "} | ||
{multiSelected.length > 0 ? multiSelected.join(", ") : "None"} | ||
</p> | ||
</Section> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default ExamplePage; |
Binary file not shown.
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 |
---|---|---|
|
@@ -23,4 +23,4 @@ | |
}, | ||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], | ||
"exclude": ["node_modules"] | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 파일 file change에서는 지우고, pr 본문에 넣어주세요!