diff --git a/src/components/elements/Filter.js b/src/components/elements/Filter.js index 512d34d..2f5696c 100644 --- a/src/components/elements/Filter.js +++ b/src/components/elements/Filter.js @@ -1,24 +1,26 @@ import React from "react"; import styled from "styled-components"; -import {Body} from "../../utils/fonts"; +import {FlexRow} from "../../utils/containers"; -const FilterStyle = styled(Body)` - display: flex; - justify-content: center; - align-items: center; +const FilterStyle = styled(FlexRow)` width: fit-content; height: 36px; padding: 8px 16px; border-radius: 32px; border: 1px solid ${({theme}) => theme.colors.dark}; box-shadow: ${({theme}) => theme.shadow}; - gap: 8px; cursor: pointer; + color: ${({theme, active}) => active ? theme.colors.white : theme.colors.dark}; + background-color: ${({theme, active}) => active ? theme.colors.darj : theme.colors.white}; + + * { + cursor: pointer; + } `; const Filter = (props) => { return ( - + {props.children} ); diff --git a/src/components/elements/FiltersMenu.js b/src/components/elements/FiltersMenu.js deleted file mode 100644 index 85c7426..0000000 --- a/src/components/elements/FiltersMenu.js +++ /dev/null @@ -1,123 +0,0 @@ -import React from "react"; -import {FlexColumn, FlexRow, Grid, TransBack} from "../../utils/containers"; -import Button from "./Button"; -import theme from "../../utils/theme"; -import styled from "styled-components"; -import {Medium} from "../../utils/fonts"; -import Filter from "./Filter"; - -const FiltersMenuStyle = styled(FlexColumn)` - position: fixed; - top: 0; - right: 0; - overflow-y: scroll; - width: 240px; - height: 100vh; - justify-content: space-around; - @media (max-height: 626px) { - justify-content: flex-start; - } - padding: 14px 16px 14px 24px; - box-shadow: ${({theme}) => theme.filtersShadow}; - background-color: ${({theme}) => theme.colors.white}; - transition: transform 0.5s ease-in-out; - z-index: 3; -`; - -const FiltersMenu = (props) => { - return ( - <> - - - - - Sort by - - - - Closing - - - Closing - - - Hotness - - - Hotness - - - Reward - - - Reward - - - - - - Status - - - - Both - - - Completed - - - Active - - - - - - Challenge type - - - - All - - - Tabular - - - Text - - - Image - - - - - - Commercial - - - - Both - - - Yes - - - No - - - - - - - - - - ); -} - -export default FiltersMenu; \ No newline at end of file diff --git a/src/components/elements/FiltersMenu/FiltersMenu.js b/src/components/elements/FiltersMenu/FiltersMenu.js new file mode 100644 index 0000000..4c5d3a2 --- /dev/null +++ b/src/components/elements/FiltersMenu/FiltersMenu.js @@ -0,0 +1,51 @@ +import React from "react"; +import {FlexColumn, FlexRow, TransBack} from "../../../utils/containers"; +import Button from "../Button"; +import theme from "../../../utils/theme"; +import styled from "styled-components"; +import FilterBy from "../../sections/FilterBy"; +import filterOptions from "./filterOptions"; + +const FiltersMenuStyle = styled(FlexColumn)` + position: fixed; + top: 0; + right: 0; + overflow-y: scroll; + width: 240px; + height: 100vh; + justify-content: space-around; + @media (max-height: 626px) { + justify-content: flex-start; + } + padding: 14px 16px 14px 24px; + box-shadow: ${({theme}) => theme.filtersShadow}; + background-color: ${({theme}) => theme.colors.white}; + transition: transform 0.5s ease-in-out; + z-index: 3; +`; + +const FiltersMenu = (props) => { + return ( + <> + + + + + + + + + + + + + ); +} + +export default FiltersMenu; \ No newline at end of file diff --git a/src/components/elements/FiltersMenu/filterOptions.js b/src/components/elements/FiltersMenu/filterOptions.js new file mode 100644 index 0000000..691b007 --- /dev/null +++ b/src/components/elements/FiltersMenu/filterOptions.js @@ -0,0 +1,66 @@ +const filterOptions = [ + [ + { + name: 'Closing', + sort: true, + }, + { + name: 'Closing', + sort: true, + rotate: '180deg' + }, + { + name: 'Hotness', + sort: true, + }, + { + name: 'Hotness', + sort: true, + rotate: '180deg' + }, + { + name: 'Reward', + sort: true, + }, + { + name: 'Reward', + sort: true, + rotate: '180deg' + } + ], [ + { + name: 'Both' + }, + { + name: 'Completed' + }, + { + name: 'Active' + }, + ], [ + { + name: 'All' + }, + { + name: 'Tabular' + }, + { + name: 'Text' + }, + { + name: 'Image' + }, + ], [ + { + name: 'Both' + }, + { + name: 'Yes' + }, + { + name: 'No' + }, + ] +]; + +export default filterOptions; \ No newline at end of file diff --git a/src/components/elements/FiltersMenu/index.js b/src/components/elements/FiltersMenu/index.js new file mode 100644 index 0000000..bcb3264 --- /dev/null +++ b/src/components/elements/FiltersMenu/index.js @@ -0,0 +1 @@ +export {default} from './FiltersMenu'; \ No newline at end of file diff --git a/src/components/sections/FilterBy.js b/src/components/sections/FilterBy.js new file mode 100644 index 0000000..8640a13 --- /dev/null +++ b/src/components/sections/FilterBy.js @@ -0,0 +1,39 @@ +import React from "react"; +import {FlexColumn, Grid, Svg} from "../../utils/containers"; +import Filter from "../elements/Filter"; +import {Body, Medium} from "../../utils/fonts"; +import arrow from "../../assets/arrow.svg"; + +const FilterBy = (props) => { + + const renderFilterOptions = () => { + return ( + props.options.map((option, index) => { + return ( + + + {option.name} + + {option.sort ? + + : ''} + + ); + }) + ); + } + + return ( + + + {props.header} + + + {renderFilterOptions()} + + + ); +} + +export default FilterBy; \ No newline at end of file diff --git a/src/pages/Challenges.js b/src/pages/Challenges.js index 0ba61a8..f891447 100644 --- a/src/pages/Challenges.js +++ b/src/pages/Challenges.js @@ -53,7 +53,7 @@ const Challenges = () => { return ( challenges.slice(n, n + ELEMENTS_PER_PAGE).map((challenge, index) => { return ( - diff --git a/src/utils/containers.js b/src/utils/containers.js index d893293..33e7064 100644 --- a/src/utils/containers.js +++ b/src/utils/containers.js @@ -51,6 +51,7 @@ const Svg = styled(Container)` mask: url(${({src}) => src}) no-repeat center; width: ${({width}) => width ? width : '16px'}; height: ${({height}) => height ? height : '16px'}; + transform: rotate(${({rotate}) => rotate ? rotate : '0'}); `; const TransBack = styled(FlexRow)`