
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
@qc/react-layer
Advanced tools
A React component that renders a div with the semantics of representing a layer.
A React component that renders a div with the semantics of representing a
layer. Layers are Blocks that are designed to be stacked.
Each layer starts a new stacking context.
npm install --save @qc/react-layer
or
yarn add @qc/react-layer
The following example shows how a page can be composed of multiple layers.
// HomePage.jsx
import React from 'react'
import Layer from '@qc/react-layer'
import Page from '@qc/react-page'
import '@qc/react-block/dist/styles/Block.css'
import '@qc/react-layer/dist/styles/Layer.css'
import '@qc/react-page/umd/react-page.css'
import './HomePage.css'
export default class HomePage extends React.Component {
render() {
const { dialogs, drawers, messages } = this.props;
return (
<Page className="HomePage">
<Layer className="MainLayer">
<Page.Head>...</Page.Head>
<Page.Body>
<h2>Home Page</h2>
...
</Page.Body>
</Layer>
<Layer className="DrawersLayer">
{drawers}
</Layer>
<Layer className="DialogLayer">
{dialogs}
</Layer>
<Layer className="MessageLayer">
{messages}
</Layer>
</Page>
)
}
}
/* HomePage.css */
.DrawersLayer {
z-index: 1;
}
.DialogLayer {
z-index: 2;
}
.MessageLayer {
z-index: 3;
}
Just Using Layer CSS
The key to the Layer component is in the CSS — not the JavaScript. So, we
need to include the Layer CSS. Also, because Layer is a Block component,
we need to include its CSS too.
import React from 'react'
import '@qc/react-block/dist/styles/Block.css'
import '@qc/react-layer/dist/styles/Layer.css'
export default function MessageLayer(props) {
return (
<div className="Block Layer">
...
</div>
)
}
@qc/react-pageAn application can be thought of as a set of pages, sometimes known as screens. Within each page may exist several layers. Layers may be explicit or implicit. An example of an explicit layer is when a React component exists for the purpose of representing a layer. That is the purpose of this library. If the layer is not explicit, then it is implicit. The main downfall of implicit layers is that it is not clear where it begins and where it ends.
There always exists at least one layer, the main layer. This layer represents/contains the main content of the page. There may be times when a need arises where a page has multiple layers. A classic example is when a modal dialog is displayed. Where the dialog is displayed is in a layer, whether implicit or explicit, above the main layer. In the same page, another layer may exist where notification messages are shown. This layer is usually above the dialog layer so that messages will be seen while a dialog is shown.
import React from 'react'
import Layer from '@qc/react-layer'
import Page from '@qc/react-page'
class HomePage extends React.Component {
render() {
const { showLightbox, showLoginModal } = this.state;
return (
<Page className="HomePage">
<Layer className="MainLayer">
<Page.Head>
{/* Insert head components here. */}
</Page.Head>
<Page.Body>
{/* Insert main components here. */}
</Page.Body>
<Page.Foot>
{/* Insert foot components here. */}
</Page.Foot>
</Layer>
{
(showLightbox || showLoginModal) &&
<Layer className="DialogLayer">
{/* Insert modals here. */}
{ showLightbox && <Lightbox/> }
{ showLoginModal && <LoginModal/> }
</Layer>
}
<Layer className="NotificationLayer">
{/* Insert notification components here. */}
</Layer>
</Page>
)
}
}
z-indexAn HTML document has one or more stacking context.
Within an given stacking context, all z-index values are treated relative to
each other. That is, z-index in one stacking context has no effect on the
z-index in a different stacking context.
To reiterate, a document with one stacking context treats all z-index values
relative to each other. A document with more than one stacking contexts treat
all z-index values within the same stacking context relative to each other.
This means that an element with a z-index of 10000 in one stacking context
won't necessarily be stacked higher than an element with a z-index of 1 in
another stacking context.
This package also comes with the source and an ES variation. Instead of
import Layer from '@qc/react-layer'
use
import Layer from '@qc/react-layer/es/Layer'
or
import Layer from '@qc/react-layer/src/Layer'
to import the component.
If you do this, then you will need to be sure to transpile the code to a syntax compatible with the browsers you plan to support.
The source is using object spread syntax. In order to transpile it with babel, you must include the object spread transform plugin.
ISC
FAQs
A React component that renders a div with the semantics of representing a layer.
The npm package @qc/react-layer receives a total of 3 weekly downloads. As such, @qc/react-layer popularity was classified as not popular.
We found that @qc/react-layer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.