-
Notifications
You must be signed in to change notification settings - Fork 0
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 #177 from Jaewoook/feature/settings-app
Prepare settings app basic layout
- Loading branch information
Showing
6 changed files
with
158 additions
and
18 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,51 @@ | ||
import { style, styleVariants } from "@vanilla-extract/css"; | ||
|
||
export const container = style({ | ||
position: "relative", | ||
}); | ||
|
||
export const selected = style({ | ||
display: "flex", | ||
alignItems: "center", | ||
fontSize: 14, | ||
padding: "4px 6px", | ||
borderRadius: 6, | ||
userSelect: "none", | ||
transition: "all .15s ease-in-out", | ||
":hover": { | ||
backgroundColor: "rgba(104, 100, 100, 1)", | ||
}, | ||
":after": { | ||
backgroundColor: "rgb(104, 100, 100)", | ||
}, | ||
selectors: { | ||
"&:hover::after": { | ||
backgroundColor: "rgb(22, 100, 220)", | ||
}, | ||
}, | ||
}); | ||
|
||
export const selectedExpandIndicator = style({ | ||
marginLeft: 4, | ||
}); | ||
|
||
export const baseOptions = style({ | ||
position: "absolute", | ||
top: "calc(100% + 4px)", | ||
left: 0, | ||
right: 0, | ||
selectors: { | ||
"&:nth-child(n+1)": { | ||
marginTop: 4, | ||
}, | ||
}, | ||
}); | ||
|
||
export const options = styleVariants({ | ||
closed: [baseOptions, { display: "none" }], | ||
opened: [baseOptions], | ||
}); | ||
|
||
export const option = style({ | ||
fontSize: 14, | ||
}); |
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,45 @@ | ||
import { useCallback, useState } from "react"; | ||
import type { SelectHTMLAttributes } from "react"; | ||
import { PiCaretUpDown } from "react-icons/pi"; | ||
|
||
import * as css from "./Select.css"; | ||
|
||
export type Options = { | ||
label: string; | ||
key: string | number; | ||
}[]; | ||
|
||
interface Props { | ||
options: Options; | ||
value: string; | ||
onChange: (value: string) => void; | ||
} | ||
|
||
export const Select = (props: Props) => { | ||
const { value, options, onChange } = props; | ||
const [optionOpened, setOptionsOpen] = useState(false); | ||
const handleOptionsClick = useCallback(() => { | ||
setOptionsOpen((prev) => !prev); | ||
}, []); | ||
|
||
return ( | ||
<div className={css.container}> | ||
<select style={{ display: "none" }}> | ||
{options.map((option) => ( | ||
<option key={option.key}>{option.label}</option> | ||
))} | ||
</select> | ||
<p className={css.selected} onClick={handleOptionsClick}> | ||
{value} | ||
<PiCaretUpDown className={css.selectedExpandIndicator} /> | ||
</p> | ||
<div className={optionOpened ? css.options.opened : css.options.closed}> | ||
{options.map((option) => ( | ||
<p key={option.key} className={css.option}> | ||
{option.label} | ||
</p> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; |
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 |
---|---|---|
@@ -1,20 +1,36 @@ | ||
import { style } from "@vanilla-extract/css"; | ||
|
||
export const container = style({ | ||
padding: "16px 12px", | ||
padding: "14px 20px", | ||
}); | ||
|
||
export const list = style({ | ||
padding: "12px 8px", | ||
padding: "0 8px", | ||
borderRadius: 4, | ||
border: "1px solid #5c5c5c", | ||
}); | ||
|
||
export const row = style({ | ||
display: "flex", | ||
alignItems: "center", | ||
minHeight: 48, | ||
padding: "0 4px", | ||
fontSize: 14, | ||
selectors: { | ||
"&:nth-child(n+2)": { | ||
borderTop: "1px solid rgb(63, 58, 58)", | ||
}, | ||
}, | ||
}); | ||
|
||
export const rowLabel = style({ | ||
fontSize: 14, | ||
color: "#fff", | ||
marginRight: "auto", | ||
}); | ||
|
||
export const infoText = style({ | ||
marginTop: 16, | ||
fontSize: 12, | ||
color: "rgba(255, 255, 255, 0.6)" | ||
}); |
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
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