Skip to content

Commit

Permalink
#101 feat: 드롭다운 기능쪽 임시 커밋
Browse files Browse the repository at this point in the history
  • Loading branch information
silvertae committed Aug 17, 2023
1 parent f28f525 commit f4d7e26
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 18 deletions.
23 changes: 15 additions & 8 deletions frontend/src/components/common/DropdownPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,25 @@ enum Option {
Selected,
}

const dummy = [
['label', Option.Selected],
['label', Option.Available],
] as [string, Option][];
// const dummy = [
// ['label', Option.Selected],
// ['label', Option.Available],
// ] as [string, Option][];

export default function DropdownPanel({ label }: { label: string }) {
export default function DropdownPanel({
elements,
label,
...rest
}: {
elements: [text: string, option: Option][];
label: string;
}) {
return (
<Container>
<Container {...rest}>
<Header>{label}</Header>
<DropdownElements>
{dummy.map(([text, option]) => {
const key = uuidV4()
{elements.map(([text, option]) => {
const key = uuidV4();
const Icon = Icons.userImageSmall;
return (
<li key={key}>
Expand Down
23 changes: 14 additions & 9 deletions frontend/src/components/common/FilterBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@ import { styled } from 'styled-components';
import DropdownIndicator from './DropdownIndicator';
import Icons from '../../design/Icons';

export default function FilterBar() {
const [filterValue, setFilterValue] = useState<string>(
'default filter option'
);
type FilterBarProps = {
filterValue: string;
openPanel: () => void;
};

export default function FilterBar({ filterValue, openPanel }: FilterBarProps) {
// const [filterValue, setFilterValue] = useState<string>(
// 'default filter option'
// );
const SearchIcon = Icons['search'];

const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setFilterValue(e.target.value);
};
// const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
// setFilterValue(e.target.value);
// };

return (
<Bar>
<StyledDropdownIndicator text="Button" />
<StyledDropdownIndicator text="Button" onClick={openPanel} />
<TextFilter>
<SearchIcon />
<TextInput value={filterValue} onChange={handleChange}></TextInput>
<TextInput value={filterValue}></TextInput>
</TextFilter>
</Bar>
);
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/landmark/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ const Container = styled.div`
justify-content: space-between;
margin-bottom: 24px;
align-items: center;
position: relative;
`;
31 changes: 30 additions & 1 deletion frontend/src/pages/Issues.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@ import Layout from '../components/Layout';
import Button from '../components/common/button/BaseButton';
import { Data } from '../types';
import useAxiosPrivate from '../hooks/useAxiosPrivate';
import DropdownPanel from '../components/common/DropdownPanel';

enum Option {
Available,
Selected,
}

export default function Issues() {
const { util } = useContext(AppContext);
const { auth, logout } = useAuth();
const logo = (util.getLogoByTheme() as ContextLogo).medium;
const navigate = useNavigate();
const axiosPrivate = useAxiosPrivate();
const [filterValue, setFilterValue] = useState<string>('status:open');

const [data, setData] = useState<Data>({
openCount: 1,
Expand Down Expand Up @@ -141,7 +148,22 @@ export default function Issues() {
</div>
</Header>
<Toolbar>
<FilterBar />
<FilterBar
filterValue="hi"
openPanel={() => {
console.log('open filterbar');
}}
/>
<FilterBarPanel
elements={[
['열린 이슈', Option.Selected],
['내가 작성한 이슈', Option.Available],
['나에게 할당된 이슈', Option.Available],
['내가 댓글을 남긴 이슈', Option.Available],
['닫힌 이슈', Option.Available],
]}
label="이슈 필터"
/>
<ActionGroup>
<TabButton
tabs={[
Expand Down Expand Up @@ -175,3 +197,10 @@ const ActionGroup = styled.div`
align-items: center;
gap: 16px;
`;

const FilterBarPanel = styled(DropdownPanel)`
position: absolute;
z-index: 1;
top: 50px;
background-color: ${({ theme }) => theme.color.neutral.surface.strong};
`;

0 comments on commit f4d7e26

Please sign in to comment.