Skip to content

Commit 2592864

Browse files
committed
[style] select박스 정렬
1 parent 4bba1c8 commit 2592864

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/app/recipe/Accordion.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ const selectOption = [
2222

2323
function Accordion() {
2424
return (
25-
<ul className="flex gap-6">
26-
{selectOption.map(({ id, option, title }, i) => {
25+
<ul className="flex w-full gap-3">
26+
{selectOption.map(({ id, option, title }) => {
2727
return (
28-
<li key={i}>
28+
<li key={id}>
2929
<SelectBox option={option} title={title} id={id} groupKey="filter" />
3030
</li>
3131
);

src/app/recipe/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function Page() {
2424
/>
2525
</section>
2626
<div className="page-layout max-w-1224 mt-6">
27-
<section className="flex flex-col-reverse items-center gap-6 md:flex-row md:justify-between md:items-center ">
27+
<section className="flex flex-col-reverse items-start gap-6 md:flex-row md:justify-between md:items-center ">
2828
<Accordion />
2929
<Input
3030
placeholder="내용을 입력해 주세요."
@@ -36,7 +36,7 @@ function Page() {
3636
<section>
3737
<div className="h-10 flex justify-between items-center mt-3 border-b-1 border-gray-light">
3838
<p>n개</p>
39-
<SelectBox option={['', '댓글순']} title="최신순" />
39+
<SelectBox option={['', '댓글순', '인기순']} title="최신순" />
4040
</div>
4141
<section className="mt-5">
4242
<CocktailList />

src/shared/components/InputBox/SelectBox.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,15 @@ function SelectBox({ id, groupKey, ref, option, title, onChange }: Props) {
6868

6969
<ul
7070
className={`w-30 bg-white text-gray-dark p-2 rounded-xl z-99 duration-200 absolute transition-all
71-
${localOpen ? 'opacity-100 top-8 right-0' : 'opacity-0 pointer-events-none top-4 right-0'}`}
71+
${
72+
groupKey
73+
? localOpen
74+
? 'opacity-100 top-8 left-0'
75+
: 'opacity-0 pointer-events-none top-4 left-0'
76+
: localOpen
77+
? 'opacity-100 top-8 right-0'
78+
: 'opacity-0 pointer-events-none top-4 right-0'
79+
}`}
7280
role="listbox"
7381
>
7482
{option.map((v, i) => (

0 commit comments

Comments
 (0)