diff --git a/src/components/generic/DropdownWithPopup.js b/src/components/generic/DropdownWithPopup.js deleted file mode 100644 index d4ab17a..0000000 --- a/src/components/generic/DropdownWithPopup.js +++ /dev/null @@ -1,122 +0,0 @@ -import React from 'react'; -import { FlexColumn, FlexRow, Grid } from '../../utils/containers'; -import { Medium } from '../../utils/fonts'; -import theme from '../../utils/theme'; -import ImageButton from './ImageButton'; -import pencilIco from '../../assets/pencil_ico.svg'; -import styled from 'styled-components'; -import PopUp from './PopUp'; -import { createPortal } from 'react-dom'; -import Search from './Search'; -import Button from './Button'; - -const DropdownWithPopupStyle = styled(FlexColumn)` - cursor: pointer; - gap: 8px; - width: 100%; - align-items: flex-start; - * { - cursor: pointer; - } -`; - -const DropdownWithPopup = (props) => { - const [tagsPopUp, setTagsPopUp] = React.useState(false); - - return ( - { - if (!tagsPopUp) setTagsPopUp(true); - }} - > - - {props.label} - - props.handler(e.target.value)} - padding="12px" - gridTemplateColumns="1fr auto" - > - - dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa - dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa - dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa - dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa dsa - - - - {tagsPopUp && - createPortal( - setTagsPopUp(false)} - > - - - - {props.tags.map((tag, index) => { - return ( - - {tag.name} - - ); - })} - - - - - - - - , - document.body - )} - - ); -}; - -export default DropdownWithPopup; diff --git a/src/pages/Submit.js b/src/pages/Submit/Submit.js similarity index 80% rename from src/pages/Submit.js rename to src/pages/Submit/Submit.js index 5592868..46eebfc 100644 --- a/src/pages/Submit.js +++ b/src/pages/Submit/Submit.js @@ -1,14 +1,14 @@ import React from 'react'; import { createPortal } from 'react-dom'; -import { FlexColumn } from '../utils/containers'; -import { H2, Menu } from '../utils/fonts'; -import SubmitInput from '../components/generic/SubmitInput'; -import Button from '../components/generic/Button'; -import theme from '../utils/theme'; -import challengeSubmission from '../api/challengeSubmissionPost'; -import Loading from '../components/generic/Loading'; -import getTags from '../api/getTags'; -import DropdownWithPopup from '../components/generic/DropdownWithPopup'; +import { FlexColumn } from '../../utils/containers'; +import { H2, Menu } from '../../utils/fonts'; +import SubmitInput from '../../components/generic/SubmitInput'; +import Button from '../../components/generic/Button'; +import theme from '../../utils/theme'; +import challengeSubmission from '../../api/challengeSubmissionPost'; +import Loading from '../../components/generic/Loading'; +import getTags from '../../api/getTags'; +import TagsChoose from './components/TagsChoose'; const Submit = (props) => { const [description, setDescription] = React.useState(''); @@ -55,7 +55,7 @@ const Submit = (props) => { /> - { + const [tagsPopUp, setTagsPopUp] = React.useState(false); + + return ( + { + if (!tagsPopUp) setTagsPopUp(true); + }} + > + + {props.label} + + props.handler(e.target.value)} + > + tags + + + {tagsPopUp && + createPortal( + , + document.body + )} + + ); +}; + +export default TagsChoose; diff --git a/src/pages/Submit/components/TagsChoose/TagsChooseStyle.js b/src/pages/Submit/components/TagsChoose/TagsChooseStyle.js new file mode 100644 index 0000000..b287546 --- /dev/null +++ b/src/pages/Submit/components/TagsChoose/TagsChooseStyle.js @@ -0,0 +1,30 @@ +import styled from 'styled-components'; +import { FlexColumn } from '../../../../utils/containers'; + +const TagsChooseStyle = styled(FlexColumn)` + cursor: pointer; + gap: 8px; + width: 100%; + align-items: flex-start; + * { + cursor: pointer; + } + + .TagsChooseStyle__grid { + border-radius: 4px; + width: 100%; + height: 100px; + border: 1px solid ${({ theme }) => theme.colors.dark}; + box-shadow: 1px 2px 4px rgba(52, 52, 52, 0.25); + padding: 12px; + grid-template-columns: 1fr auto; + } + + .TagsChooseStyle__tags-container { + height: 100%; + justify-content: flex-start; + align-items: flex-start; + } +`; + +export default TagsChooseStyle; diff --git a/src/pages/Submit/components/TagsChoose/index.js b/src/pages/Submit/components/TagsChoose/index.js new file mode 100644 index 0000000..05aa6f3 --- /dev/null +++ b/src/pages/Submit/components/TagsChoose/index.js @@ -0,0 +1 @@ +export { default } from './TagsChoose'; diff --git a/src/pages/Submit/components/TagsChoosePopUp.js b/src/pages/Submit/components/TagsChoosePopUp.js new file mode 100644 index 0000000..abd4f01 --- /dev/null +++ b/src/pages/Submit/components/TagsChoosePopUp.js @@ -0,0 +1,67 @@ +import React from 'react'; +import PopUp from '../../../components/generic/PopUp'; +import { FlexColumn, FlexRow } from '../../../utils/containers'; +import Search from '../../../components/generic/Search'; +import theme from '../../../utils/theme'; +import Button from '../../../components/generic/Button'; + +const TagsChoosePopUp = (props) => { + return ( + props.setTagsPopUp(false)} + > + + + + {props.tags.map((tag, index) => { + return ( + + {tag.name} + + ); + })} + + + + + + + + + ); +}; + +export default TagsChoosePopUp; diff --git a/src/pages/Submit/index.js b/src/pages/Submit/index.js new file mode 100644 index 0000000..b5be4d5 --- /dev/null +++ b/src/pages/Submit/index.js @@ -0,0 +1 @@ +export { default } from './Submit';