refactor(ui): use variables for z-index values (#3453)
This commit is contained in:
@ -9,6 +9,7 @@ import {
|
|||||||
colors,
|
colors,
|
||||||
colorsRaw,
|
colorsRaw,
|
||||||
lengths,
|
lengths,
|
||||||
|
zIndex,
|
||||||
} from 'netlify-cms-ui-default';
|
} from 'netlify-cms-ui-default';
|
||||||
|
|
||||||
const LoginButton = styled.button`
|
const LoginButton = styled.button`
|
||||||
@ -38,7 +39,7 @@ const AuthInput = styled.input`
|
|||||||
margin-top: 6px;
|
margin-top: 6px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: ${zIndex.zIndex1};
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
|
@ -14,6 +14,7 @@ import {
|
|||||||
lengths,
|
lengths,
|
||||||
shadows,
|
shadows,
|
||||||
buttons,
|
buttons,
|
||||||
|
zIndex,
|
||||||
} from 'netlify-cms-ui-default';
|
} from 'netlify-cms-ui-default';
|
||||||
import SettingsDropdown from 'UI/SettingsDropdown';
|
import SettingsDropdown from 'UI/SettingsDropdown';
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ const AppHeader = props => (
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
top: 0;
|
top: 0;
|
||||||
background-color: ${colors.foreground};
|
background-color: ${colors.foreground};
|
||||||
z-index: 300;
|
z-index: ${zIndex.zIndex300};
|
||||||
height: ${lengths.topBarHeight};
|
height: ${lengths.topBarHeight};
|
||||||
`}
|
`}
|
||||||
{...props}
|
{...props}
|
||||||
|
@ -3,7 +3,7 @@ import styled from '@emotion/styled';
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { boundGetAsset } from 'Actions/media';
|
import { boundGetAsset } from 'Actions/media';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { colors, colorsRaw, components, lengths } from 'netlify-cms-ui-default';
|
import { colors, colorsRaw, components, lengths, zIndex } from 'netlify-cms-ui-default';
|
||||||
import { VIEW_STYLE_LIST, VIEW_STYLE_GRID } from 'Constants/collectionViews';
|
import { VIEW_STYLE_LIST, VIEW_STYLE_GRID } from 'Constants/collectionViews';
|
||||||
import { summaryFormatter } from 'Lib/formatters';
|
import { summaryFormatter } from 'Lib/formatters';
|
||||||
import { keyToPathArray } from 'Lib/stringTemplate';
|
import { keyToPathArray } from 'Lib/stringTemplate';
|
||||||
@ -68,7 +68,7 @@ const CardBody = styled.div`
|
|||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: block;
|
display: block;
|
||||||
z-index: 1;
|
z-index: ${zIndex.zIndex1};
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: -20%;
|
left: -20%;
|
||||||
height: 140%;
|
height: 140%;
|
||||||
|
@ -5,7 +5,7 @@ import styled from '@emotion/styled';
|
|||||||
import { css } from '@emotion/core';
|
import { css } from '@emotion/core';
|
||||||
import { translate } from 'react-polyglot';
|
import { translate } from 'react-polyglot';
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom';
|
||||||
import { Icon, components, colors, colorsRaw, lengths } from 'netlify-cms-ui-default';
|
import { Icon, components, colors, colorsRaw, lengths, zIndex } from 'netlify-cms-ui-default';
|
||||||
import { searchCollections } from 'Actions/collections';
|
import { searchCollections } from 'Actions/collections';
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
@ -43,7 +43,7 @@ const SearchContainer = styled.div`
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 6px;
|
left: 6px;
|
||||||
z-index: 2;
|
z-index: ${zIndex.zIndex2};
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -58,7 +58,7 @@ const SearchInput = styled.input`
|
|||||||
padding: 10px 6px 10px 32px;
|
padding: 10px 6px 10px 32px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: ${zIndex.zIndex1};
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
|
@ -4,7 +4,14 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
|||||||
import { css, Global } from '@emotion/core';
|
import { css, Global } from '@emotion/core';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import SplitPane from 'react-split-pane';
|
import SplitPane from 'react-split-pane';
|
||||||
import { colors, colorsRaw, components, transitions, IconButton } from 'netlify-cms-ui-default';
|
import {
|
||||||
|
colors,
|
||||||
|
colorsRaw,
|
||||||
|
components,
|
||||||
|
transitions,
|
||||||
|
IconButton,
|
||||||
|
zIndex,
|
||||||
|
} from 'netlify-cms-ui-default';
|
||||||
import { ScrollSync, ScrollSyncPane } from 'react-scroll-sync';
|
import { ScrollSync, ScrollSyncPane } from 'react-scroll-sync';
|
||||||
import EditorControlPane from './EditorControlPane/EditorControlPane';
|
import EditorControlPane from './EditorControlPane/EditorControlPane';
|
||||||
import EditorPreviewPane from './EditorPreviewPane/EditorPreviewPane';
|
import EditorPreviewPane from './EditorPreviewPane/EditorPreviewPane';
|
||||||
@ -107,7 +114,7 @@ const ViewControls = styled.div`
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
z-index: 299;
|
z-index: ${zIndex.zIndex299};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
class EditorInterface extends Component {
|
class EditorInterface extends Component {
|
||||||
|
@ -15,6 +15,7 @@ import {
|
|||||||
colors,
|
colors,
|
||||||
components,
|
components,
|
||||||
buttons,
|
buttons,
|
||||||
|
zIndex,
|
||||||
} from 'netlify-cms-ui-default';
|
} from 'netlify-cms-ui-default';
|
||||||
import { status } from 'Constants/publishModes';
|
import { status } from 'Constants/publishModes';
|
||||||
import SettingsDropdown from 'UI/SettingsDropdown';
|
import SettingsDropdown from 'UI/SettingsDropdown';
|
||||||
@ -55,7 +56,7 @@ const ToolbarContainer = styled.div`
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 800px;
|
min-width: 800px;
|
||||||
z-index: 300;
|
z-index: ${zIndex.zIndex300};
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
height: 66px;
|
height: 66px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
import { css } from '@emotion/core';
|
import { css } from '@emotion/core';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { FileUploadButton } from 'UI';
|
import { FileUploadButton } from 'UI';
|
||||||
import { buttons, shadows } from 'netlify-cms-ui-default';
|
import { buttons, shadows, zIndex } from 'netlify-cms-ui-default';
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
button: css`
|
button: css`
|
||||||
@ -46,7 +46,7 @@ const StyledUploadButton = styled(FileUploadButton)`
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 0;
|
z-index: ${zIndex.zIndex0};
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { Icon, lengths, colors } from 'netlify-cms-ui-default';
|
import { Icon, lengths, colors, zIndex } from 'netlify-cms-ui-default';
|
||||||
|
|
||||||
const SearchContainer = styled.div`
|
const SearchContainer = styled.div`
|
||||||
height: 37px;
|
height: 37px;
|
||||||
@ -19,7 +19,7 @@ const SearchInput = styled.input`
|
|||||||
padding: 10px 6px 10px 32px;
|
padding: 10px 6px 10px 32px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: ${zIndex.zIndex1};
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
@ -31,7 +31,7 @@ const SearchIcon = styled(Icon)`
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 6px;
|
left: 6px;
|
||||||
z-index: 2;
|
z-index: ${zIndex.zIndex2};
|
||||||
transform: translate(0, -50%);
|
transform: translate(0, -50%);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { css, Global, ClassNames } from '@emotion/core';
|
import { css, Global, ClassNames } from '@emotion/core';
|
||||||
import ReactModal from 'react-modal';
|
import ReactModal from 'react-modal';
|
||||||
import { transitions, shadows, lengths } from 'netlify-cms-ui-default';
|
import { transitions, shadows, lengths, zIndex } from 'netlify-cms-ui-default';
|
||||||
|
|
||||||
const ReactModalGlobalStyles = () => (
|
const ReactModalGlobalStyles = () => (
|
||||||
<Global
|
<Global
|
||||||
@ -29,7 +29,7 @@ const styleStrings = {
|
|||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
overlay: `
|
overlay: `
|
||||||
z-index: 99999;
|
z-index: ${zIndex.zIndex99999};
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|||||||
import { css, Global } from '@emotion/core';
|
import { css, Global } from '@emotion/core';
|
||||||
import { translate } from 'react-polyglot';
|
import { translate } from 'react-polyglot';
|
||||||
import reduxNotificationsStyles from 'redux-notifications/lib/styles.css';
|
import reduxNotificationsStyles from 'redux-notifications/lib/styles.css';
|
||||||
import { shadows, colors, lengths } from 'netlify-cms-ui-default';
|
import { shadows, colors, lengths, zIndex } from 'netlify-cms-ui-default';
|
||||||
|
|
||||||
const ReduxNotificationsGlobalStyles = () => (
|
const ReduxNotificationsGlobalStyles = () => (
|
||||||
<Global
|
<Global
|
||||||
@ -12,7 +12,7 @@ const ReduxNotificationsGlobalStyles = () => (
|
|||||||
${reduxNotificationsStyles};
|
${reduxNotificationsStyles};
|
||||||
|
|
||||||
.notif__container {
|
.notif__container {
|
||||||
z-index: 10000;
|
z-index: ${zIndex.zIndex10000};
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
`}
|
`}
|
||||||
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
import { css } from '@emotion/core';
|
import { css } from '@emotion/core';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { Wrapper, Button as DropdownButton, Menu, MenuItem } from 'react-aria-menubutton';
|
import { Wrapper, Button as DropdownButton, Menu, MenuItem } from 'react-aria-menubutton';
|
||||||
import { buttons, components } from './styles';
|
import { buttons, components, zIndex } from './styles';
|
||||||
import Icon from './Icon';
|
import Icon from './Icon';
|
||||||
|
|
||||||
const StyledWrapper = styled(Wrapper)`
|
const StyledWrapper = styled(Wrapper)`
|
||||||
@ -37,7 +37,7 @@ const DropdownList = styled.ul`
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
z-index: 2;
|
z-index: ${zIndex.zIndex2};
|
||||||
|
|
||||||
${props => css`
|
${props => css`
|
||||||
width: ${props.width};
|
width: ${props.width};
|
||||||
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { css, keyframes } from '@emotion/core';
|
import { css, keyframes } from '@emotion/core';
|
||||||
import CSSTransition from 'react-transition-group/CSSTransition';
|
import CSSTransition from 'react-transition-group/CSSTransition';
|
||||||
import { colors } from './styles';
|
import { colors, zIndex } from './styles';
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
disabled: css`
|
disabled: css`
|
||||||
@ -122,7 +122,7 @@ const StyledLoader = styled(Loader)`
|
|||||||
left: 50%;
|
left: 50%;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
z-index: 1000;
|
z-index: ${zIndex.zIndex1000};
|
||||||
transform: translateX(-50%) translateY(-50%);
|
transform: translateX(-50%) translateY(-50%);
|
||||||
|
|
||||||
&:before,
|
&:before,
|
||||||
|
@ -21,6 +21,7 @@ import {
|
|||||||
borders,
|
borders,
|
||||||
transitions,
|
transitions,
|
||||||
effects,
|
effects,
|
||||||
|
zIndex,
|
||||||
reactSelectStyles,
|
reactSelectStyles,
|
||||||
GlobalStyles,
|
GlobalStyles,
|
||||||
} from './styles';
|
} from './styles';
|
||||||
@ -53,6 +54,7 @@ export const NetlifyCmsUiDefault = {
|
|||||||
borders,
|
borders,
|
||||||
transitions,
|
transitions,
|
||||||
effects,
|
effects,
|
||||||
|
zIndex,
|
||||||
reactSelectStyles,
|
reactSelectStyles,
|
||||||
GlobalStyles,
|
GlobalStyles,
|
||||||
};
|
};
|
||||||
@ -84,6 +86,7 @@ export {
|
|||||||
borders,
|
borders,
|
||||||
transitions,
|
transitions,
|
||||||
effects,
|
effects,
|
||||||
|
zIndex,
|
||||||
reactSelectStyles,
|
reactSelectStyles,
|
||||||
GlobalStyles,
|
GlobalStyles,
|
||||||
GoBackButton,
|
GoBackButton,
|
||||||
|
@ -380,6 +380,20 @@ const reactSelectStyles = {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const zIndex = {
|
||||||
|
zIndex0: 0,
|
||||||
|
zIndex1: 1,
|
||||||
|
zIndex2: 2,
|
||||||
|
zIndex10: 10,
|
||||||
|
zIndex100: 100,
|
||||||
|
zIndex200: 200,
|
||||||
|
zIndex299: 299,
|
||||||
|
zIndex300: 300,
|
||||||
|
zIndex1000: 1000,
|
||||||
|
zIndex10000: 10000,
|
||||||
|
zIndex99999: 99999,
|
||||||
|
};
|
||||||
|
|
||||||
const GlobalStyles = () => (
|
const GlobalStyles = () => (
|
||||||
<Global
|
<Global
|
||||||
styles={css`
|
styles={css`
|
||||||
@ -480,6 +494,7 @@ export {
|
|||||||
borders,
|
borders,
|
||||||
transitions,
|
transitions,
|
||||||
effects,
|
effects,
|
||||||
|
zIndex,
|
||||||
reactSelectStyles,
|
reactSelectStyles,
|
||||||
GlobalStyles,
|
GlobalStyles,
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { Icon, buttons, shadows } from 'netlify-cms-ui-default';
|
import { Icon, buttons, shadows, zIndex } from 'netlify-cms-ui-default';
|
||||||
|
|
||||||
const StyledSettingsButton = styled.button`
|
const StyledSettingsButton = styled.button`
|
||||||
${buttons.button};
|
${buttons.button};
|
||||||
@ -8,7 +8,7 @@ const StyledSettingsButton = styled.button`
|
|||||||
${shadows.drop};
|
${shadows.drop};
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 100;
|
z-index: ${zIndex.zIndex100};
|
||||||
right: 8px;
|
right: 8px;
|
||||||
top: 8px;
|
top: 8px;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import Select from 'react-select';
|
import Select from 'react-select';
|
||||||
import isHotkey from 'is-hotkey';
|
import isHotkey from 'is-hotkey';
|
||||||
import { text, shadows } from 'netlify-cms-ui-default';
|
import { text, shadows, zIndex } from 'netlify-cms-ui-default';
|
||||||
import SettingsButton from './SettingsButton';
|
import SettingsButton from './SettingsButton';
|
||||||
import languageSelectStyles from './languageSelectStyles';
|
import languageSelectStyles from './languageSelectStyles';
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ const SettingsPaneContainer = styled.div`
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
z-index: 10;
|
z-index: ${zIndex.zIndex10};
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -7,7 +7,7 @@ import { css as coreCss, ClassNames } from '@emotion/core';
|
|||||||
import { get, isEmpty, debounce } from 'lodash';
|
import { get, isEmpty, debounce } from 'lodash';
|
||||||
import { Value, Document, Block, Text } from 'slate';
|
import { Value, Document, Block, Text } from 'slate';
|
||||||
import { Editor as Slate } from 'slate-react';
|
import { Editor as Slate } from 'slate-react';
|
||||||
import { lengths, fonts } from 'netlify-cms-ui-default';
|
import { lengths, fonts, zIndex } from 'netlify-cms-ui-default';
|
||||||
import { editorStyleVars, EditorControlBar } from '../styles';
|
import { editorStyleVars, EditorControlBar } from '../styles';
|
||||||
import { slateToMarkdown, markdownToSlate } from '../serializers';
|
import { slateToMarkdown, markdownToSlate } from '../serializers';
|
||||||
import Toolbar from '../MarkdownControl/Toolbar';
|
import Toolbar from '../MarkdownControl/Toolbar';
|
||||||
@ -28,7 +28,7 @@ const visualEditorStyles = ({ minimal }) => `
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
z-index: 100;
|
z-index: ${zIndex.zIndex100};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const InsertionPoint = styled.div`
|
const InsertionPoint = styled.div`
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* eslint-disable react/prop-types */
|
/* eslint-disable react/prop-types */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { css } from '@emotion/core';
|
import { css } from '@emotion/core';
|
||||||
|
import { zIndex } from 'netlify-cms-ui-default';
|
||||||
|
|
||||||
const InsertionPoint = props => (
|
const InsertionPoint = props => (
|
||||||
<div
|
<div
|
||||||
@ -8,7 +9,7 @@ const InsertionPoint = props => (
|
|||||||
height: 32px;
|
height: 32px;
|
||||||
cursor: text;
|
cursor: text;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: ${zIndex.zIndex1};
|
||||||
margin-top: -16px;
|
margin-top: -16px;
|
||||||
`}
|
`}
|
||||||
{...props}
|
{...props}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
import { zIndex } from 'netlify-cms-ui-default';
|
||||||
|
|
||||||
export const editorStyleVars = {
|
export const editorStyleVars = {
|
||||||
stickyDistanceBottom: '100px',
|
stickyDistanceBottom: '100px',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const EditorControlBar = styled.div`
|
export const EditorControlBar = styled.div`
|
||||||
z-index: 200;
|
z-index: ${zIndex.zIndex200};
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
margin-bottom: ${editorStyleVars.stickyDistanceBottom};
|
margin-bottom: ${editorStyleVars.stickyDistanceBottom};
|
||||||
|
Reference in New Issue
Block a user