
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@h2oai/ui-kit
Advanced tools
This is a library of shared components and themes for sharing code between Web front ends. As of this writing, this library is based on Microsoft's Fluent UI library of components, with an applied theme expressing H2O's corporate visual design.
This is a library of shared components and themes for sharing code between Web front ends. As of this writing, this library is based on Microsoft's Fluent UI library of components, with an applied theme expressing H2O's corporate visual design.
Implements components in H2O Design Library (https://xd.adobe.com/view/eebb600c-026b-4ca1-bb6b-0a439235452b-bbe8/) Some components are not in H2O Design Library.
click UI kit Storybook
To view the library locally, and browser the different components, use Storybook: npm run storybook
and you will see the library in your local browser. Use Storybook to develop and validate new components as you work:
In order for PRs to be merged into master, the PR must pass several tests:
npm run test
.npm run format:check
. To auto-format all files, run npm run format
npm run lint
.npx tsc
There is a NPM script storybook:screenshots
which generates a screenshot of all stories in the Storybook. The images are stored in __screenshots__
directory.
The script uses Storycap library which relies on Puppeteer. For deterministic results, script is running in Docker container, so Docker has to be installed on you machine and running. The PNG generators on different platform yields different PNG images although visually they are identical, since we want to track diffs, we have to eliminate this platform difference.
You can run storybook:screenshots
to generate images of stories, if there will be a change in the image, you can use the Git diff tool to inspect differences.
The screenshots are also taken on the GitHub for the pull-requests (PR), the GitHub Action generates a screenshots and if there is a difference, it sends a commit to the PR branch, so the reviewers can see the diff and tell if it is a problem or not.
This repository contains two package.json
files, one in the root and one inside the src/
directory. The src/
project is private and contains development tooling that relies on the peerDependencies
. The reason is hassle-free npm link
. if all those tooling and peerDependencies
would be installed in the root, then the peerDependencies
would leak into the client project during the npm link
and cause many headaches.
Since npm@7 the npm install
installs peerDependencies
by default, we prevent that with omit = peer
in .npmrc
. The dependencies in src
are installed automatically for you via a prepare
scripts.
We use CSS-in-JS library of Fluent UI.
ui-kit is based on box-sizing: border-box
The UI-Kit uses Fluent's icon-font, the users of UI-Kit are responsible for initializing (fetching) the icon-font and registering the glyphs in Fluent system. The documentation is covered in Fluent's wiki. If there are no special requirements, just add following snippet into entry file of your application.
import { initializeIcons } from '@fluentui/react';
initializeIcons();
data-test
instead of data-testid
The UI-Kit uses data-test
prop instead of data-testid
for screen.getByTestId()
.
You need to add below code to the setup test file.
import { configure } from '@testing-library/react';
configure({ testIdAttribute: 'data-test' });
the default colors are in themes/colors.ts
file.
<H2OThemeProvider>
App
</H2OThemeProvider>
const darkTheme: IH2OTheme = {
semanticColors: {
linkText: 'white',
...
}
}
<H2OThemeProvider theme={darkTheme}>
App
</H2OThemeProvider>
Every component has ComponentName.styles.ts
file which has simple style objects or functions that return a simple style object.
The function name is componentNameStyles
+ style name. It is for IDE friendly name.
The function of the default styles is componentNameStylesDefault
like footerStylesDefault
, linkStylesDefault
.
e.g) linkStylesDefault
, linkStylesBlack
, linkStylesIcon
The default styles componentNameStylesDefault
is already applied internally. If you need to add additional styles you can use styles
prop as below example. styles
prop can have a single style object & function or an array of the functions & style objects.
export interface IAppBarStyles {
root?: IStyle;
logo?: IStyle;
menuIcon?: IStyle;
title?: IStyle;
content?: IStyle;
userMenu?: IStyle;
}
// simple style object
export const appBarStylesDefault = (theme: IH2OTheme): IAppBarStyles => ({
root: {
display: 'flex',
...
},
logo: {
cursor: 'pointer',
...
},
menuIcon: {
paddingLeft: 24,
...
},
title: {
cursor: 'pointer',
...
},
content: { flex: 1, ... },
userMenu: {
paddingLeft: 32,
...
},
});
export const appBarStylesThin = (theme: IH2OTheme): IAppBarStyles => ({
root: {
height: 96,
...
},
});
export const appBarStylesThick = (theme: IH2OTheme): IAppBarStyles => ({
root: {
height: 96,
...
},
});
export const appBarStylesBlack = (theme: IH2OTheme): IAppBarStyles => ({
root: {
backgroundColor: theme.palette?.black
...
},
});
const myAppBarStyles: IAppBarStyles = {
root: {
width: 200
}
};
<AppBar styles={appBarStylesThick}>
<AppBar styles={[appBarStylesThick, appBarStylesBlack, myAppBarStyles]}>
<AppBar styles={appBarStylesThin}>
<AppBar styles={[appBarStylesThin, appBarStylesBlack, {root: {width: 100}}]}>
ui-kit uses github actions to publish it for now. When Jenkins is ready, we don't need the github action.
package.json
Draft a new release
Choose a tag
-> Input the new version x.x.x
-> Click Create new tag:x.x.x
Release title
as the version x.x.x
Publish release
You can publish an npm package by running npm publish
. You can publish your branch as a beta version of the npm package to test your components or changes in the ui-kit. You can also install the beta version in your project and test it. If you think it is ready to be released, you can make a PR with the official version.
xx.xx.x-b1
if you need to deploy it again, you can use the next beta version xx.xx.x-b2
...xx.xx.x-bn
npm run build
-> npm publish
npm install xx.xx.x-b1
npx link
You can use npx link
instead of the beta version. npx
is better and safer than npm
. See the details here https://hirok.io/posts/avoid-npm-link
cd ./your-project-web-folder
npx link ../../ui-kit-folder
FAQs
This is a library of shared components and themes for sharing code between Web front ends. As of this writing, this library is based on Microsoft's Fluent UI library of components, with an applied theme expressing H2O's corporate visual design.
We found that @h2oai/ui-kit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.