npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hsl-shared-components

v7.0.3-0

Published

Shared components to be used in HSL projects. React and styled components.

Downloads

76

Readme

Project @ gitLab --> https://gitlab.hsl.fi/mobidigi/shared-components

Changelog: --> https://gitlab.hsl.fi/mobidigi/shared-components/blob/master/CHANGELOG.md

Install package

  1. yarn add hsl-shared-components
  2. Add required peer dependencies to your project

Install fonts

Required font --> https://www.typography.com/fonts/gotham-rounded/styles/

For web app

  1. Use embed code / method provided for your app
  2. For *.hsl.fi-domains:
<link rel="stylesheet" type="text/css" href="https://cloud.typography.com/6364294/7319392/css/fonts.css" />

For react native app

  1. copy assets/ -folder to your project --> https://gitlab.hsl.fi/mobidigi/shared-components
  2. package.json:
  "rnpm": {
    "assets": [
      "./assets/fonts"
    ]
  },
  1. run react-native link

Add required providers

import React from 'react';
import PropTypes from 'prop-types';
import { ThemeProvider } from 'styled-components';
import Theme from 'hsl-shared-components/lib/Theme';

const App = () => (
  <ThemeProvider theme={Theme}>
    ...
  </ThemeProvider>
);

export default App;

Add required polyfills

Your application may need to polyfill Promise, Object.assign, and Array.from as necessary for your desired browser support.

Easiest way to achieve this is using babel-polyfill

  1. yarn install babel-polyfill
  2. In project root add import 'babel-polyfill'

Usage

Standard

import ToggleButton from 'hsl-shared-components/lib/ToggleButton';

...

<ToggleButton title="Toggle me!" />

Custom positioning

import ToggleButton from 'hsl-shared-components/lib/ToggleButton';

const StyledToggleButton = ToggleButton.extend`
  position: absolute;
  bottom: 10px;
  width: 200px;
`;

...

<StyledToggleButton title="Toggle me!" />

Different styles with custom props

import ToggleButton from 'hsl-shared-components/lib/ToggleButton';

const StyledToggleButton = styled(({
  floating,
  ...rest
}) =>
  <ToggleButton {...rest} />
)`
  ${props => props.floating && `
    position: absolute;
    bottom: 10px;
  `}
`;

...

<StyledToggleButton title="Toggle me!" floating={trueOrFalse} />

Theme

Use theme outside styled-components

import { withTheme } from 'styled-components';

const MyComponent = withTheme(props =>
  <InfoIcon fill={props.theme.colors.primary.hslBlue} />
);

Add your own stuff or override theme vars

Theme source: https://gitlab.hsl.fi/mobidigi/shared-components/tree/master/packages/hsl-shared-components/src/Theme

import React from 'react';
import PropTypes from 'prop-types';
import { ThemeProvider } from 'styled-components';
import Theme from 'hsl-shared-components/lib/Theme';

const MyModifiedTheme = {
  ...Theme,
  custom: {
    aliceblue: '#f0f8ff',
  }
};

const App = () => (
  <ThemeProvider theme={MyModifiedTheme}>
    ...
  </ThemeProvider>
);

export default App;