
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@trend/drawer
Advanced tools
React off-canvas menu region that can contain a title, sub-title, and a self-contained inner scrollable area.
## Has peer dependency with react and react-dom
npm install react react-dom
npm install @trend/Drawer
With a module bundler like webpack, use as you would anything else:
// Using ES6 modules.
import React from 'react';
import Drawer from '@trend/drawer';
const {
getRootProps,
getHdProps,
getTitleProps,
getSubtitleProps,
getInnerProps
} = Drawer.api();
function Aside({ children }) {
return <Drawer>
<div {...getRootProps()}>
<div {...getHdProps()}>
<h1 {...getTitleProps()}>Drawer Title</h1>
<h2 {...getSubtitleProps()}>Drawer SubTitle</h2>
</div>
<div {...getInnerProps({ className: 'tc-phb'})}>
Inner Drawer area
</div>
</div>
</Drawer>;
}
// or pass children as a function
function AsideChildFunction({ children }) {
return <Drawer>
{ api => (
<div {...api.getRootProps()}>
<div {...api.getHdProps()}>
<h1 {...api/getTitleProps()}>Drawer Title</h1>
<h2 {...api.getSubtitleProps()}>Drawer SubTitle</h2>
</div>
<div {...api.getInnerProps({ className: 'tc-phb'})}>
Inner Drawer area
</div>
</div>
)}
</Drawer>;
}
Returns an object of prop-getters for various sub-components to build out. See api table for getters.
This is a controlled component, use the open
prop to adjust the visibility
of the drawer.
// Using ES6 modules.
import React from 'react';
import { DrawerOverlay as Drawer } from '@trend/drawer';
function Aside({ open, toggleDrawer }) {
return <Drawer open={open} onToggle={toggleDrawer}>
{ api => (
<Fragment>
<div {...api.getHdProps()}>
<h1 {...api.getTitleProps()}>Title</h1>
<h2 {...api.getSubtitleProps()}>SubTitle</h2>
</div>
<div {...api.getInnerProps({className: 'tc-phb'})}>
<a className="tc-display-block"
href="#"
onClick={this.onLinkClick}>
link 1
</a>
<a className="tc-display-block"
href="#"
onClick={this.onLinkClick}>
link 2
</a>
<button className="tc-display-block"
onClick={this.toggleDrawer}>
link 3
</button>
</div>
</Fragment>
)}
</Drawer>;
}
NOTE Drawer overaly will automatically generate the root element, unlike the default Drawer
component where the developer is responsible for implementing the root node. The default HTML tag is a div, pass in a tag
prop to change the default.
boolean
| optional,true
Render a mask under the drawer above the content when opened.
function
| optional,noop
Function that gets called on clicks to the mask or areas outside of a drawer while opened.
boolean
| required,false
The prop that will toggle the display of the drawer.
This API is the same for both the default and overlay drawer types.
Property | Category | Type | Description |
---|---|---|---|
getRootProps | prop getter | function(props: object) | Returns props to the root node Only available for default Drawer. |
getHdProps | prop getter | function(props: object) | Returns props for the header sub-component. |
getTitleProps | prop getter | function(props: object) | Returns props for the drawer title. |
getSubtitleProps | prop getter | function(props: object) | Returns props for the drawer subtitle. |
getInnerProps | prop getter | function(props: object) | Returns props for the drawer inner sub-component. |
FAQs
"TREND Components drawer component."
The npm package @trend/drawer receives a total of 0 weekly downloads. As such, @trend/drawer popularity was classified as not popular.
We found that @trend/drawer 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.