diff --git a/src/components/Links/LinkTargetBlank/LinkTargetBlank.tsx b/src/components/Links/LinkTargetBlank/LinkTargetBlank.tsx index 6286d747d0..6548ac8dcc 100644 --- a/src/components/Links/LinkTargetBlank/LinkTargetBlank.tsx +++ b/src/components/Links/LinkTargetBlank/LinkTargetBlank.tsx @@ -1,6 +1,7 @@ import * as React from 'react' import { Link } from 'rebass' import ImageTargetBlank from 'src/assets/icons/link-target-blank.svg' +import { zIndex } from 'src/themes/styled.theme' export const LinkTargetBlank = props => ( ( backgroundImage: `url("${ImageTargetBlank}")`, width: '20px', height: '20px', - zIndex: 0, + zIndex: `${zIndex.level}`, backgroundSize: 'contain', backgroundRepeat: 'no-repeat', position: 'absolute', diff --git a/src/components/Modal/Modal.tsx b/src/components/Modal/Modal.tsx index 1183c2712a..ad28c856bd 100644 --- a/src/components/Modal/Modal.tsx +++ b/src/components/Modal/Modal.tsx @@ -2,6 +2,7 @@ import * as React from 'react' import { Portal } from 'react-portal' import { Box } from 'rebass' import styled from 'styled-components' +import { zIndex } from 'src/themes/styled.theme' interface IProps { // provide onDidDismiss function to enable backdrop click dismiss @@ -18,7 +19,7 @@ const ModalBackdrop = styled(Box)` left: 0; width: 100%; height: 100%; - z-index: 9; + z-index: ${zIndex.modalBackdrop}; background: rgba(0, 0, 0, 0.4); ` const ModalContent = styled(Box)` @@ -31,7 +32,7 @@ const ModalContent = styled(Box)` max-width: 100%; max-height: 100%; position: fixed; - z-index: 10; + z-index: ${zIndex.modalContent}; left: 50%; top: 50%; transform: translate(-50%, -50%); diff --git a/src/components/MoreContainer/MoreContainer.tsx b/src/components/MoreContainer/MoreContainer.tsx index 0ad8345ce0..a56f4e6cb0 100644 --- a/src/components/MoreContainer/MoreContainer.tsx +++ b/src/components/MoreContainer/MoreContainer.tsx @@ -7,6 +7,7 @@ import WhiteBubble1 from 'src/assets/images/white-bubble_1.svg' import WhiteBubble2 from 'src/assets/images/white-bubble_2.svg' import WhiteBubble3 from 'src/assets/images/white-bubble_3.svg' import { BoxProps } from 'rebass' +import { zIndex } from 'src/themes/styled.theme' const MoreModalContainer = styled(Box)` position: relative; @@ -16,7 +17,7 @@ const MoreModalContainer = styled(Box)` background-image: url(${WhiteBubble0}); width: 100%; height: 100%; - z-index: -1; + z-index: ${zIndex.behind}; background-size: contain; background-repeat: no-repeat; position: absolute; diff --git a/src/components/ProfileModal/ProfileModal.tsx b/src/components/ProfileModal/ProfileModal.tsx index dc6ffa82ad..0b2401fd33 100644 --- a/src/components/ProfileModal/ProfileModal.tsx +++ b/src/components/ProfileModal/ProfileModal.tsx @@ -6,7 +6,7 @@ import { inject, observer } from 'mobx-react' import { COMMUNITY_PAGES_PROFILE } from 'src/pages/PageList' import { NavLink } from 'react-router-dom' import Flex from 'src/components/Flex' -import theme from 'src/themes/styled.theme' +import theme, { zIndex } from 'src/themes/styled.theme' interface IProps { username: string @@ -24,11 +24,11 @@ const ModalContainer = styled(Box)` position: absolute; right: 10px; top: 60px; - z-index: 900; + z-index: ${zIndex.modalProfile}; height: 100%; ` -const ModalContent = styled(Box)` - z-index: 900; +const ModalContainerInner = styled(Box)` + z-index: ${zIndex.modalProfile}; position: relative; background: white; border: 2px solid black; @@ -38,7 +38,7 @@ const ModalContent = styled(Box)` const ModalLink = styled(NavLink).attrs(({ name }) => ({ activeClassName: 'current', }))` - z-index: 900; + z-index: ${zIndex.modalProfile}; display: flex; flex-direction: column; color: #000; @@ -80,7 +80,7 @@ export class ProfileModal extends React.Component { const { username } = this.props return ( - + Profile @@ -94,11 +94,15 @@ export class ProfileModal extends React.Component { ))} - this.logout()} to={'/how-to'} data-cy="menu-item"> + this.logout()} + to={'/how-to'} + data-cy="menu-item" + > Log out - + ) } diff --git a/src/pages/Howto/Content/Howto/Howto.tsx b/src/pages/Howto/Content/Howto/Howto.tsx index 8eee57f1e6..d5ba44fa6d 100644 --- a/src/pages/Howto/Content/Howto/Howto.tsx +++ b/src/pages/Howto/Content/Howto/Howto.tsx @@ -19,6 +19,7 @@ import WhiteBubble2 from 'src/assets/images/white-bubble_2.svg' import WhiteBubble3 from 'src/assets/images/white-bubble_3.svg' import { IUser } from 'src/models/user.models' import { Link } from 'src/components/Links' +import { zIndex } from 'src/themes/styled.theme' // The parent container injects router props along with a custom slug parameter (RouteComponentProps). // We also have injected the doc store to access its methods to get doc by slug. @@ -41,7 +42,7 @@ const MoreBox = styled(Box)` background-image: url(${WhiteBubble0}); width: 100%; height: 100%; - z-index: -1; + z-index: ${zIndex.behind}; background-size: contain; background-repeat: no-repeat; position: absolute; @@ -120,7 +121,9 @@ export class Howto extends React.Component< - + diff --git a/src/pages/Maps/Content/Controls/index.tsx b/src/pages/Maps/Content/Controls/index.tsx index ff3a3c45b8..35fd5b2b3c 100644 --- a/src/pages/Maps/Content/Controls/index.tsx +++ b/src/pages/Maps/Content/Controls/index.tsx @@ -12,6 +12,7 @@ import { HashLink } from 'react-router-hash-link' import { AuthWrapper } from 'src/components/Auth/AuthWrapper' import { Map } from 'react-leaflet' import { ILocation } from 'src/models/common.models' +import { zIndex } from 'src/themes/styled.theme' import { inject } from 'mobx-react' import { MapsStore } from 'src/stores/Maps/maps.store' @@ -35,7 +36,7 @@ const MapFlexBar = styled(Flex)` position: absolute; top: 25px; width: 100%; - z-index: 3; + z-index: ${zIndex.mapFlexBar}; left: 50%; transform: translateX(-50%); ` diff --git a/src/pages/User/content/UserPage/UserPage.tsx b/src/pages/User/content/UserPage/UserPage.tsx index 289241e902..9f60b05995 100644 --- a/src/pages/User/content/UserPage/UserPage.tsx +++ b/src/pages/User/content/UserPage/UserPage.tsx @@ -17,6 +17,7 @@ import styled from 'styled-components' import Icon from 'src/components/Icons' import Flex from 'src/components/Flex' import ElWithBeforeIcon from 'src/components/ElWithBeforeIcon' +import { zIndex } from 'src/themes/styled.theme' import theme from 'src/themes/styled.theme' import { capitalizeFirstLetter } from 'src/utils/helpers' @@ -78,7 +79,7 @@ interface IProps {} const UserCategory = styled.div` position: relative; display: inline-block; - z-index: 1; + z-index: ${zIndex.default}; &:after { content: ''; @@ -87,7 +88,7 @@ const UserCategory = styled.div` position: absolute; top: 0; - z-index: -1; + z-index: ${zIndex.behind}; background-repeat: no-repeat; background-size: contain; left: 0; diff --git a/src/pages/common/Header/Menu/Logo/Logo.tsx b/src/pages/common/Header/Menu/Logo/Logo.tsx index 8b004e0fd9..a06b8a93a9 100644 --- a/src/pages/common/Header/Menu/Logo/Logo.tsx +++ b/src/pages/common/Header/Menu/Logo/Logo.tsx @@ -6,6 +6,7 @@ import LogoImage from 'src/assets/images/logo.svg' import MobileLogoImage from 'src/assets/images/logo-mobile.svg' import LogoBackground from 'src/assets/images/logo-background.svg' import Text from 'src/components/Text' +import { zIndex } from 'src/themes/styled.theme' interface IProps { isMobile?: boolean @@ -16,7 +17,18 @@ const LogoContainer = styled(Flex)` width: 200px; align-items: center; position: relative; - + &:before { + content: ''; + position: absolute; + background-image: url(${LogoBackground}); + width: 250px; + height: 70px; + z-index: ${zIndex.logoContainer}; + background-size: contain; + background-repeat: no-repeat; + top: 0; + left: 0px; + } @media only screen and (max-width: ${theme.breakpoints[1]}) { &:before { left: -50px; diff --git a/src/pages/common/Header/Menu/MenuDesktop.tsx b/src/pages/common/Header/Menu/MenuDesktop.tsx index 458ef36bfe..ec716e7d90 100644 --- a/src/pages/common/Header/Menu/MenuDesktop.tsx +++ b/src/pages/common/Header/Menu/MenuDesktop.tsx @@ -5,6 +5,7 @@ import theme from 'src/themes/styled.theme' import { Flex } from 'rebass/styled-components' import styled from 'styled-components' import MenuCurrent from 'src/assets/images/menu-current.svg' +import { zIndex } from 'src/themes/styled.theme' const MenuLink = styled(NavLink).attrs(({ name }) => ({ activeClassName: 'current', @@ -13,7 +14,7 @@ const MenuLink = styled(NavLink).attrs(({ name }) => ({ color: ${'black'}; position: relative; > div { - z-index: 1; + z-index: ${zIndex.default}; position: relative; &:hover { opacity: 0.7; @@ -28,7 +29,7 @@ const MenuLink = styled(NavLink).attrs(({ name }) => ({ position: absolute; bottom: -6px; background-image: url(${MenuCurrent}); - z-index: 0; + z-index: ${zIndex.level}; background-repeat: no-repeat; background-size: contain; left: 50%; diff --git a/src/pages/common/Header/Menu/Profile/ProfileButtonItem.tsx b/src/pages/common/Header/Menu/Profile/ProfileButtonItem.tsx index 28ff378473..1c7b873879 100644 --- a/src/pages/common/Header/Menu/Profile/ProfileButtonItem.tsx +++ b/src/pages/common/Header/Menu/Profile/ProfileButtonItem.tsx @@ -47,9 +47,7 @@ export class ProfileButtonItem extends React.Component { ? ['flex', 'flex', 'none'] : ['none', 'none', 'flex'] } - {...(this.props.isMobile - ? { large: true } - : { medium: true })} + {...(this.props.isMobile ? { large: true } : { medium: true })} data-cy={this.props.text.toLowerCase()} style={this.props.style} > diff --git a/src/themes/app.globalStyle.js b/src/themes/app.globalStyle.js index 0ca9153b3a..72cbbfa1a6 100644 --- a/src/themes/app.globalStyle.js +++ b/src/themes/app.globalStyle.js @@ -1,5 +1,5 @@ import { createGlobalStyle } from 'styled-components' -import theme from 'src/themes/styled.theme' +import theme, { zIndex } from 'src/themes/styled.theme' // Import css files for Slick-slider // import "../../node_modules/slick-carousel/slick/slick.css"; // import "../../node_modules/slick-carousel/slick/slick-theme.css"; @@ -34,7 +34,7 @@ export const GlobalStyle = createGlobalStyle` .slick-next { position: absolute; top: 50%; - z-index: 100; + z-index: ${zIndex.slickArrows}; transform: translateY(-50%); cursor: pointer; } diff --git a/src/themes/styled.theme.tsx b/src/themes/styled.theme.tsx index 8ab3f9f512..abba6cb439 100644 --- a/src/themes/styled.theme.tsx +++ b/src/themes/styled.theme.tsx @@ -16,6 +16,18 @@ export const colors = { silver: '#c0c0c0', } +export const zIndex = { + behind: -1, + level: 0, + default: 1, + modalBackdrop: 9, + modalContent: 10, + slickArrows: 100, + modalProfile: 900, + logoContainer: 999, + mapFlexBar: 99999, +} + export type ButtonVariants = | 'primary' | 'secondary' @@ -176,4 +188,5 @@ export default { maxContainerWidth, regular, bold, + zIndex, }