Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
An App Bar for React that stays out of your way.
When the scrolling is just right
Also known as a Header, a Navigation Bar, or a Navbar. I chose App Bar because it was available on npm.
npm · GitLab<AppBar />
with, like styled-components or emotionwindow.requestAnimationFrame
. You could use a polyfill for older browsersposition: sticky;
support. For Safari, you should add position: -webkit-sticky;
to your own styles. Unfortunately this is not possible to support with React's inline style syntax.Basic usage:
import React from 'react';
import { css } from 'emotion';
import Navigation from 'app-bar';
import { HamburgerMenu, Logo } from './components';
...
const styles = css`
background-color: white;
box-shadow: ${open ? 'none' : '0 1px 2px rgba(0, 0, 0, 0.08)'};
height: 64px;
position: -webkit-sticky /* This is needed for Safari support */
`;
...
<Navigation className={styles} disabled={open}>
<Logo />
<HamburgerMenu open={open} />
</Navigation>
The app-bar
comes with very little defaults, and should be styled by supplying it with a className
property that is attached some CSS.
The <AppBar />
component is <nav />
element with the following inline styles:
display: block;
position: sticky;
width: 100%;
In other words, <AppBar />
is a fixed full-width element that sticks to the top of your screen. The only functionality is that <AppBar />
will move out the viewport when scrolling down, and back in when scrolling up. This is done by controlling the top
CSS property.
There are three additional classes added for the different states possible:
unfixed
is applied when <AppBar />
doesn't touch the top of the screen but is on the pagehidden
is applied when <AppBar />
is fully hidden (for example, after scrolling down or reloading page when scrolled)pinned
is applied when <AppBar />
scrolling up from being hidden
These classes can be used for styling (see demo for example).If you want to disable <AppBar />
's behaviour, supply the disabled
prop. When disabled, <AppBar />
will simply stick to the top of the screen.
If you need to access the dom element, you can supply a function via the innerRef
prop.
FAQs
An app bar for React that stays out of your way
The npm package app-bar receives a total of 2 weekly downloads. As such, app-bar popularity was classified as not popular.
We found that app-bar 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.