-
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 branch 'develop' into feat/participate-be
- Loading branch information
Showing
25 changed files
with
393 additions
and
18 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from "react"; | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
|
||
import Filter from "./Filter"; | ||
|
||
export default { | ||
title: "Example/Filter", | ||
component: Filter, | ||
} as ComponentMeta<typeof Filter>; | ||
|
||
const Template: ComponentStory<typeof Filter> = (args) => <Filter {...args} />; | ||
|
||
export const Text = Template.bind({}); | ||
Text.args = { | ||
filterState: { currentFilter: "5km ์ด๋ด", options: ["5km ์ด๋ด", "3km ์ด๋ด", "1km ์ด๋ด"] }, | ||
}; |
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,26 @@ | ||
import styled from "styled-components"; | ||
import { COLOR } from "styles/color"; | ||
import { fontSmall } from "styles/font"; | ||
|
||
export const ModalFilterWrapper = styled.div` | ||
width: 50vw; | ||
div { | ||
border-radius: 5px; | ||
cursor: pointer; | ||
padding: 4px 4px 8px 8px; | ||
${fontSmall(COLOR.BLACK, 500)} | ||
div&:hover { | ||
background: rgba(0, 0, 0, 0.1); | ||
} | ||
} | ||
& :last-child { | ||
border-top: 1px solid gray; | ||
} | ||
button { | ||
padding-top: 4px; | ||
width: 100%; | ||
border: none; | ||
background: transparent; | ||
${fontSmall(COLOR.BLACK, 700)} | ||
} | ||
`; |
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,77 @@ | ||
import styled from "styled-components"; | ||
import { useState } from "react"; | ||
import { flexRowCenter } from "styles/flex"; | ||
import { ARROW_DOWN_ICON, LOCATION_ICON } from "#assets/icons"; | ||
import { fontMedium } from "styles/font"; | ||
import { COLOR } from "styles/color"; | ||
import Modal from "#components/Modal/Modal"; | ||
import { ModalFilterWrapper } from "./Filter.style"; | ||
|
||
//does not contain dropdown logic, only primitive filter skeleton | ||
|
||
const FilterWrapper = styled.div` | ||
${flexRowCenter} | ||
padding: 4px; | ||
border-radius: 20px; | ||
cursor: pointer; | ||
p { | ||
white-space: nowrap; | ||
${fontMedium(COLOR.BLACK, 500)} | ||
font-family: "Noto Sans KR"; | ||
margin: 0 10px 0 5px; | ||
} | ||
img { | ||
height: 18px; | ||
} | ||
&:hover { | ||
background: rgba(0, 0, 0, 0.05); | ||
} | ||
`; | ||
|
||
type _filterState = { | ||
currentFilter: string; | ||
options: string[]; | ||
}; | ||
interface FilterProps { | ||
filterState: _filterState; | ||
setCurrentFilterState: any; | ||
} | ||
|
||
const Filter = ({ filterState, setCurrentFilterState }: FilterProps) => { | ||
const [showModal, setShowModal] = useState(false); | ||
|
||
const handleToggleModal = () => { | ||
setShowModal(!showModal); | ||
}; | ||
|
||
const handleFilterContentClick = (e: React.MouseEvent<HTMLElement>) => { | ||
const target = e.target as HTMLElement; | ||
setCurrentFilterState(target.innerText); | ||
handleToggleModal(); | ||
}; | ||
|
||
const createModalContents = (filterOptions: string[]) => { | ||
return filterOptions.map((filterName: string, i: number) => ( | ||
<div key={i} onClick={handleFilterContentClick}> | ||
{filterName} | ||
</div> | ||
)); | ||
}; | ||
|
||
return ( | ||
<FilterWrapper onClick={handleToggleModal}> | ||
<Modal toggled={showModal} toggleVisible={handleToggleModal}> | ||
<ModalFilterWrapper> | ||
{createModalContents(filterState.options)} | ||
<button onClick={handleToggleModal}>๋ซ๊ธฐ</button> | ||
</ModalFilterWrapper> | ||
</Modal> | ||
<img src={LOCATION_ICON} /> | ||
<p>{filterState.currentFilter}</p> | ||
<img src={ARROW_DOWN_ICON} /> | ||
</FilterWrapper> | ||
); | ||
}; | ||
|
||
export default Filter; |
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,10 @@ | ||
import React from "react"; | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import FilterBar from "./FilterBar"; | ||
|
||
export default { | ||
title: "Example/FilterBar", | ||
component: FilterBar, | ||
} as ComponentMeta<typeof FilterBar>; | ||
|
||
export const _FilterBar: ComponentStory<typeof FilterBar> = (args) => <FilterBar {...args} />; |
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,20 @@ | ||
import styled from "styled-components"; | ||
import { COLOR } from "styles/color"; | ||
import { flexRow } from "styles/flex"; | ||
|
||
const FilterBarWrapper = styled.div` | ||
${flexRow}; | ||
padding: 4px 4px; | ||
gap: 2rem; | ||
border-bottom: ${`1px solid ${COLOR.BABY_BLUE}`}; | ||
`; | ||
|
||
interface FilterBarProps { | ||
children?: React.ReactNode; | ||
} | ||
|
||
const FilterBar = ({ children }: FilterBarProps) => { | ||
return <FilterBarWrapper>{children}</FilterBarWrapper>; | ||
}; | ||
|
||
export default FilterBar; |
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
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
Oops, something went wrong.