From 0baf64c40298dc051112834d44c8540e9db8fe90 Mon Sep 17 00:00:00 2001 From: ghalestrilo Date: Mon, 10 Aug 2020 11:29:12 -0300 Subject: [PATCH] :recycle: make Tab and TabSwitcher mobile components --- client/components/mobile/Tab.jsx | 18 +++++++++++ client/components/mobile/TabSwitcher.jsx | 15 ++++++++++ client/modules/Mobile/MobileDashboardView.jsx | 30 +++---------------- 3 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 client/components/mobile/Tab.jsx create mode 100644 client/components/mobile/TabSwitcher.jsx diff --git a/client/components/mobile/Tab.jsx b/client/components/mobile/Tab.jsx new file mode 100644 index 00000000..016b29d2 --- /dev/null +++ b/client/components/mobile/Tab.jsx @@ -0,0 +1,18 @@ +import React from 'react'; +import styled from 'styled-components'; +import { Link } from 'react-router'; +import { prop, remSize } from '../../theme'; + +export default styled(Link)` + box-sizing: border-box; + + + background: transparent; + /* border-top: ${remSize(4)} solid ${props => prop(props.selected ? 'colors.p5jsPink' : 'MobilePanel.default.background')}; */ + border-top: ${remSize(4)} solid ${props => (props.selected ? prop('colors.p5jsPink') : 'transparent')}; + + color: ${prop('primaryTextColor')}; + + padding: ${remSize(8)} ${remSize(16)}; + width: 30%; +`; diff --git a/client/components/mobile/TabSwitcher.jsx b/client/components/mobile/TabSwitcher.jsx new file mode 100644 index 00000000..15a3bb0e --- /dev/null +++ b/client/components/mobile/TabSwitcher.jsx @@ -0,0 +1,15 @@ +import React from 'react'; +import styled from 'styled-components'; + +import { prop, remSize } from '../../theme'; + +export default styled.div` + display: flex; + justify-content: space-between; + + h3 { text-align: center; width: 100%; } + border-top: 1px solid ${prop('Separator')}; + + background: ${props => prop('backgroundColor')}; +`; + diff --git a/client/modules/Mobile/MobileDashboardView.jsx b/client/modules/Mobile/MobileDashboardView.jsx index 824da862..a2e2c228 100644 --- a/client/modules/Mobile/MobileDashboardView.jsx +++ b/client/modules/Mobile/MobileDashboardView.jsx @@ -2,14 +2,14 @@ import React from 'react'; import PropTypes from 'prop-types'; import styled from 'styled-components'; import { useSelector } from 'react-redux'; -import { withRouter, Link } from 'react-router'; +import { withRouter } from 'react-router'; import Screen from '../../components/mobile/MobileScreen'; import Header from '../../components/mobile/Header'; import IconButton from '../../components/mobile/IconButton'; import { ExitIcon, MoreIcon } from '../../common/icons'; import Footer from '../../components/mobile/Footer'; -import { prop, remSize } from '../../theme'; +import { remSize } from '../../theme'; import SketchList from '../IDE/components/SketchList'; import CollectionList from '../IDE/components/CollectionList'; import AssetList from '../IDE/components/AssetList'; @@ -18,6 +18,8 @@ import { SketchSearchbar, CollectionSearchbar } from '../IDE/components/Searchba import Button from '../../common/Button'; import useAsModal from '../../components/useAsModal'; import Dropdown from '../../components/Dropdown'; +import FooterTabSwitcher from '../../components/mobile/TabSwitcher'; +import FooterTab from '../../components/mobile/Tab'; const EXAMPLE_USERNAME = 'p5'; @@ -59,30 +61,6 @@ const ContentWrapper = styled(Content)` .sketches-table-container { padding-bottom: ${remSize(160)} } `; -const FooterTabSwitcher = styled.div` - display: flex; - justify-content: space-between; - - h3 { text-align: center; width: 100%; } - border-top: 1px solid ${prop('Separator')}; - - background: ${props => prop('backgroundColor')}; -`; - -const FooterTab = styled(Link)` - box-sizing: border-box; - - - background: transparent; - /* border-top: ${remSize(4)} solid ${props => prop(props.selected ? 'colors.p5jsPink' : 'MobilePanel.default.background')}; */ - border-top: ${remSize(4)} solid ${props => (props.selected ? prop('colors.p5jsPink') : 'transparent')}; - - color: ${prop('primaryTextColor')}; - - padding: ${remSize(8)} ${remSize(16)}; - width: 30%; -`; - const Subheader = styled.div` display: flex; flex-direction: row;