Skip to content

chore: standardize z-indexs #881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/gatsby-theme-newrelic/src/components/Banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Banner = ({ children, visible, onClose, ...props }) => {
background-color: var(--brand-button-primary-accent);
min-height: 5.625rem;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
z-index: 100;
z-index: var(--depth-5);
position: relative;

h1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const CustomTextInput = ({
left: 10px;
line-height: 1;
top: -11px;
z-index: 1;
z-index: var(--depth-1);
`}
>
{label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Menu = ({ children, className }) => {
display: ${open ? 'block' : 'none'};
background: var(--secondary-background-color);
border-radius: 0.25rem;
z-index: 1000;
z-index: var(--depth-9);
padding: 0.5rem;
box-shadow: 0 3px 8px 0 rgba(22, 38, 59, 0.2);

Expand All @@ -48,7 +48,7 @@ const Menu = ({ children, className }) => {
border-bottom: var(--arrow-size) solid var(--background-color);
width: 0;
height: 0;
z-index: 1000;
z-index: var(--depth-9);

${ARROW_ALIGNMENTS[align]};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const GlobalFooter = ({ className }) => {
css={css`
color: var(--system-text-primary-dark);
background-color: var(--system-text-primary-light);
z-index: 1;
z-index: var(--depth-1);

a {
color: var(--system-text-primary-dark);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const GlobalHeader = ({ className, activeSite, hideSearch = false }) => {
box-shadow: var(--shadow-2);
position: sticky;
top: 0;
z-index: 80;
z-index: var(--depth-2);
height: var(--global-header-height);
@media screen and (max-width: ${LAYOUT_BREAKPOINT}) and (min-width: ${NAV_BREAKPOINT}) {
grid-template-columns: calc(150px + var(--site-content-padding)) minmax(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,17 @@ import { css } from '@emotion/react';

export default css`
--global-header-height: 72px;

/* elevations for z-index */
/* --depth-1 is closest to the page, */
/* --depth-9 is farthest away */
--depth-1: 10;
--depth-2: 20;
--depth-3: 30;
--depth-4: 40;
--depth-5: 50;
--depth-6: 60;
--depth-7: 70;
--depth-8: 80;
--depth-9: 90;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const Popover = forwardRef(({ id, hidden = false }, ref) => {
bottom: 200%;
position: absolute;
visibility: hidden;
z-index: 81;
z-index: var(--depth-3);

&.visible {
visibility: visible;
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-theme-newrelic/src/components/Lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const Lightbox = ({ children }) => {
display: flex;
justify-content: center;
align-items: center;
z-index: 900;
z-index: var(--depth-8);
background: var(--modal-wrapper-color);
`}
onClick={() => setLightboxOpen(false)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const MobileNavModal = ({ children, style, onClose }) => {
left: 0;
bottom: 0;
right: 0;
z-index: 90;
z-index: var(--depth-4);

background: ${rgba('#d5d7d7', 0.5)};

Expand All @@ -47,7 +47,7 @@ const MobileNavModal = ({ children, style, onClose }) => {
bottom: 0.5rem;
left: 1rem;
right: 1rem;
z-index: 100;
z-index: var(--depth-5);
transform-origin: top right;
box-shadow: var(--shadow-6);
background-color: var(--erno-black);
Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby-theme-newrelic/src/components/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Modal = ({ onClose, isOpen, children, className }) => {
bottom: 0;
left: 0;
padding: var(--site-content-padding);
z-index: 900;
z-index: var(--depth-8);
background: ${rgba('#d5d7d7', 0.75)};

.dark-mode & {
Expand All @@ -49,7 +49,7 @@ const Modal = ({ onClose, isOpen, children, className }) => {
css={css`
--horizontal-spacing: 1rem;

z-index: 101;
z-index: var(--depth-6);
max-width: 1024px;
width: 100%;
margin: auto;
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-theme-newrelic/src/components/Overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Overlay = ({ children, onCloseOverlay, isOpen = false, className }) => {
<Portal>
<div
css={css`
z-index: 1000;
z-index: var(--depth-9);
position: fixed;
top: 0;
left: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const SearchInput = forwardRef(
margin: 0;
padding: 0;
outline: none;
z-index: 123;
z-index: var(--depth-7);
`}
type="button"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const SearchModal = ({ onClose, isOpen }) => {
bottom: 0;
left: 0;
padding: var(--site-content-padding);
z-index: 900;
z-index: var(--depth-8);
background: var(--modal-wrapper-color);

@media screen and (max-width: 760px) {
Expand Down Expand Up @@ -148,7 +148,7 @@ const SearchModal = ({ onClose, isOpen }) => {
css={css`
--horizontal-spacing: 1rem;

z-index: 101;
z-index: var(--depth-6);
max-width: 1024px;
width: 100%;
margin: auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const SelectInline = ({ disabled, className, label, ...props }) => (
left: 10px;
line-height: 1;
top: -11px;
z-index: 1;
z-index: var(--depth-1);
`}
>
{label}
Expand Down