Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 095b063

Browse files
authored
refactor: export z-index seperately (#1320)
1 parent 09ef539 commit 095b063

File tree

15 files changed

+34
-35
lines changed

15 files changed

+34
-35
lines changed

src/containers/digest/ArticleDigest/styles/desktop_view/fixed_header.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled from 'styled-components'
22

33
import type { TTestable, TMetric, TActive, TThread } from '@/spec'
4-
import css, { theme } from '@/utils/css'
4+
import css, { theme, zIndex } from '@/utils/css'
55
import Img from '@/Img'
66

77
import { getFixStickerOffset, getFixStickerAlign } from './metric'
@@ -13,7 +13,7 @@ export const Wrapper = styled.nav.attrs(({ testid }: TTestable) => ({
1313
${css.flex('justify-center')};
1414
top: ${({ show }) => (show ? 0 : '-48px;')};
1515
opacity: ${({ show }) => (show ? 1 : 0)};
16-
z-index: ${({ show }) => (show ? css.zIndex.articleFixedHeader : -1)};
16+
z-index: ${({ show }) => (show ? zIndex.articleFixedHeader : -1)};
1717
1818
position: fixed;
1919
top: 0;

src/containers/tool/Doraemon/styles/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled from 'styled-components'
22

33
import type { TTestable, TActive } from '@/spec'
4-
import css, { theme } from '@/utils/css'
4+
import css, { theme, zIndex } from '@/utils/css'
55

66
export const PageOverlay = styled.div.attrs(({ testid }: TTestable) => ({
77
'data-test-id': testid,
@@ -12,7 +12,7 @@ export const PageOverlay = styled.div.attrs(({ testid }: TTestable) => ({
1212
position: fixed;
1313
right: 0;
1414
top: 0;
15-
z-index: ${css.zIndex.doraemonOverlay};
15+
z-index: ${zIndex.doraemonOverlay};
1616
display: ${({ visible }) => (visible ? 'block' : 'none')};
1717
background: ${({ visible }) =>
1818
visible ? '#000' : 'transparent'}; // to-theme
@@ -29,7 +29,7 @@ export const PanelContainer = styled.div.attrs(({ testid }: TTestable) => ({
2929
max-width: 550px;
3030
position: fixed;
3131
top: 12vh;
32-
z-index: ${css.zIndex.doraemon};
32+
z-index: ${zIndex.doraemon};
3333
margin: auto;
3434
left: 0;
3535
right: 0;

src/containers/tool/Doraemon/styles/results_list.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import styled from 'styled-components'
22

33
import type { TActive } from '@/spec'
44
import Img from '@/Img'
5-
import css, { theme, animate } from '@/utils/css'
5+
import css, { theme, animate, zIndex } from '@/utils/css'
66

77
export const Wrapper = styled.div<{ empty: boolean }>`
88
position: relative;
@@ -28,7 +28,7 @@ export const PageOverlay = styled.div<TActive>`
2828
position: fixed;
2929
right: 0;
3030
top: 0;
31-
z-index: ${css.zIndex.doraemonOverlay};
31+
z-index: ${zIndex.doraemonOverlay};
3232
display: ${({ visible }) => (visible ? 'block' : 'none')};
3333
`
3434
// flex-grow example: http://zhoon.github.io/css3/2014/08/23/flex.html
@@ -38,7 +38,7 @@ export const PanelContainer = styled.div<TActive>`
3838
max-width: 550px;
3939
position: fixed;
4040
top: 12vh;
41-
z-index: ${css.zIndex.doraemon};
41+
z-index: ${zIndex.doraemon};
4242
display: ${({ visible }) => (visible ? 'block' : 'none')};
4343
left: 50%;
4444
margin-left: -19vw;

src/containers/tool/Drawer/styles/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import styled from 'styled-components'
22
import { contains } from 'ramda'
33

44
import type { TActive } from '@/spec'
5-
import css, { theme } from '@/utils/css'
5+
import css, { theme, zIndex } from '@/utils/css'
66

77
import type { TDrawer, TSwipe } from '../spec'
88
import {
@@ -23,7 +23,7 @@ export const DrawerOverlay = styled.div<TActive>`
2323
height: 100%;
2424
right: 0;
2525
top: 0;
26-
z-index: ${css.zIndex.drawerOverlay};
26+
z-index: ${zIndex.drawerOverlay};
2727
visibility: ${({ visible }) => (visible ? 'visible' : 'hidden')};
2828
background: ${({ visible }) => (visible ? theme('drawer.mask') : 'none')};
2929
opacity: ${({ visible }) => (visible ? 0.5 : 0)};
@@ -74,7 +74,7 @@ export const DrawerWrapper = styled.div.attrs(
7474
contains(type, WIDE_CASE) ? WIDE_WIDTH : NARROW_WIDTH};
7575
7676
min-width: ${({ type }) => (contains(type, WIDE_CASE) ? '700px' : '450px')};
77-
z-index: ${({ visible }) => (visible ? css.zIndex.drawer : -1)};
77+
z-index: ${({ visible }) => (visible ? zIndex.drawer : -1)};
7878
7979
visibility: ${({ visible }) => (visible ? 'visible' : 'hidden')};
8080
opacity: ${({ visible, fromContentEdge }) =>

src/containers/unit/ModeLine/styles/bottom_bar/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styled from 'styled-components'
33
import type { TTestable } from '@/spec'
44
import Img from '@/Img'
55
import { TYPE } from '@/constant'
6-
import css, { theme } from '@/utils/css'
6+
import css, { theme, zIndex } from '@/utils/css'
77

88
type TMenuIcon = { active: boolean; colorTheme: string; raw?: string }
99

@@ -18,7 +18,7 @@ export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({
1818
width: 100%;
1919
height: 35px;
2020
background: #0e3b4a;
21-
z-index: ${css.zIndex.modeLine};
21+
z-index: ${zIndex.modeLine};
2222
box-shadow: ${({ isMenuActive }) =>
2323
!isMenuActive ? '' : '-5px 6px 37px -8px rgba(0, 0, 0, 0.42)'};
2424
`

src/containers/unit/ModeLine/styles/top_bar/desktop_view.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled from 'styled-components'
22

33
import type { TTestable, TActive } from '@/spec'
4-
import css, { theme, WIDTH } from '@/utils/css'
4+
import css, { theme, WIDTH, zIndex } from '@/utils/css'
55

66
type TWrapper = TTestable & { noBorder: boolean; leftOffset: string }
77
export const WrapperBase = styled.div.attrs(({ testid }: TTestable) => ({
@@ -29,7 +29,7 @@ export const InnerWrapperBase = styled.div`
2929
export const Wrapper = styled.div<TActive>`
3030
${css.flex('justify-center')};
3131
position: fixed;
32-
z-index: ${css.zIndex.header};
32+
z-index: ${zIndex.header};
3333
top: ${({ visible }) => (visible ? '0' : '-33px')};
3434
width: 100%;
3535
max-width: ${WIDTH.COMMUNITY.PAGE};

src/containers/unit/ModeLine/styles/top_bar/mobile_view/article_bar/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import styled from 'styled-components'
22

33
import type { TActive } from '@/spec'
44
import Img from '@/Img'
5-
import css, { theme } from '@/utils/css'
5+
import css, { theme, zIndex } from '@/utils/css'
66

77
export const Wrapper = styled.div<TActive>`
88
${css.flex('justify-start')};
99
position: fixed;
10-
z-index: ${css.zIndex.header};
10+
z-index: ${zIndex.header};
1111
top: ${({ visible }) => (visible ? '0' : '-33px')};
1212
width: 100%;
1313
/* TODO: move namespace to modeline */

src/containers/unit/ModeLine/styles/top_bar/mobile_view/community_bar/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import styled from 'styled-components'
22

33
import type { TActive } from '@/spec'
4-
import css, { theme } from '@/utils/css'
4+
import css, { theme, zIndex } from '@/utils/css'
55

66
export const Wrapper = styled.div<TActive>`
77
${css.flex('justify-start')};
88
position: fixed;
9-
z-index: ${css.zIndex.header};
9+
z-index: ${zIndex.header};
1010
top: ${({ visible }) => (visible ? '0' : '-33px')};
1111
width: 100%;
1212
/* TODO: move namespace to modeline */

src/containers/unit/Sidebar/styles/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components'
22

3-
import css, { theme } from '@/utils/css'
3+
import css, { theme, zIndex } from '@/utils/css'
44

55
import { getMainWidth, getShadow, SIDEBAR_WIDTH } from './metric'
66

@@ -14,7 +14,7 @@ export const Wrapper = styled.aside<TWrapper>`
1414
height: 100vh;
1515
border-right: 1px solid;
1616
border-color: ${theme('sidebar.borderColor')};
17-
z-index: ${css.zIndex.sidebar};
17+
z-index: ${zIndex.sidebar};
1818
1919
transform: ${({ ispulled }) =>
2020
ispulled ? 'translateX(0)' : `translateX(-${SIDEBAR_WIDTH})`};
@@ -39,7 +39,7 @@ export const MainWrapper = styled.div.attrs(
3939
4040
height: 100vh;
4141
background: ${theme('sidebar.bg')};
42-
z-index: ${css.zIndex.sidebar};
42+
z-index: ${zIndex.sidebar};
4343
4444
transition: width 0.1s, box-shadow 0.25s cubic-bezier(0.25, 1, 0.5, 1);
4545
`

src/containers/unit/Sidebar/styles/menu_list/menu_bar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled from 'styled-components'
22

33
import type { TActive } from '@/spec'
4-
import css, { theme } from '@/utils/css'
4+
import css, { theme, zIndex } from '@/utils/css'
55
import Img from '@/Img'
66
import CommunityFaceLogo from '@/widgets/CommunityFaceLogo'
77

@@ -10,7 +10,7 @@ type TMenuItemTitle = TActive & { pin: boolean }
1010
export const Wrapper = styled.div`
1111
display: block;
1212
position: relative;
13-
z-index: ${css.zIndex.sidebar + 1};
13+
z-index: ${zIndex.sidebar + 1};
1414
1515
transition: all 0.2s;
1616
`

0 commit comments

Comments
 (0)