You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

glitz-style-function

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glitz-style-function

A tiny [Glitz](https://github.com/frenic/glitz) utility function to be able to pass props to a style function. Any `$`-prefixed props will be emitted and never reach the inner styled component. It's basically an alternative `styled` function that accepts

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Glitz

A tiny Glitz utility function to be able to pass props to a style function. Any $-prefixed props will be emitted and never reach the inner styled component. It's basically an alternative styled function that accepts functions that returns a style object as a second argument, which original styled doesn't.

import { styled } from '@glitz/react';
import withStyleFunction from 'glitz-style-function';

const Link = withStyleFunction(styled.A, props => ({ fontSize: props.$size === 'large' ? '24px' : '18px' }));

const Message = withStyleFunction(
  props => (
    <div className={props.apply()}>
      {props.title}
      {props.children}
      <Link href="/more/info" $size="large">
        More info
      </Link>
    </div>;
  ),
  props => ({ backgroundColor: props.$success ? 'green' : 'red' }),
);

export default () => {
  <Message title="Hurray!" $success>
    The operation was successful
  </Message>;
};

Read more at @glitz/react!

Note! This package was primarily created for a easier migration from Styletron to Glitz.

FAQs

Package last updated on 28 Aug 2018

Did you know?

Socket

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.

Install

Related posts