How to use the @modulz/radix-system.margin.propNames function in @modulz/radix-system

To help you get started, we’ve selected a few @modulz/radix-system examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github modulz / radix / packages / radix / src / components / CheckboxButton.tsx View on Github external
import React from 'react';
import styled from 'styled-components';
import css from '@styled-system/css';
import omit from 'lodash.omit';
import pick from 'lodash.pick';
import { margin, MarginProps } from '@modulz/radix-system';

export type CheckboxButtonProps = MarginProps &
  React.ComponentPropsWithRef<'input'> & { children: React.ReactNode };

const marginPropNames = margin.propNames;

export const CheckboxButton = React.forwardRef(
  ({ children, ...props }, forwardedRef) => {
    const marginProps = pick(props, marginPropNames);
    const inputProps = omit(props, marginPropNames);

    return (
      
        <input type="checkbox">
        {children}
      
    );
  }
);

const CheckboxWrapper = styled('label')(
github modulz / radix / packages / radix / src / components / Switch.tsx View on Github external
import React, { FC, ComponentProps } from 'react';
import styled from 'styled-components';
import css from '@styled-system/css';
import omit from 'lodash.omit';
import pick from 'lodash.pick';
import { margin, MarginProps } from '@modulz/radix-system';
import themeGet from '@styled-system/theme-get';

export type SwitchProps = MarginProps &amp; ComponentProps&lt;'input'&gt;;

const marginPropNames = margin.propNames;

export const Switch: FC = ({ children, ...props }) =&gt; {
  const marginProps = pick(props, marginPropNames);
  const inputProps = omit(props, marginPropNames);

  return (
    
      <input type="checkbox">
      
    
  );
};

const SwitchWrapper = styled('label')(
  css({
    position: 'relative',
github modulz / radix / packages / radix / src / components / RadioGroup.tsx View on Github external
const isControlled = Boolean(value);

  return (
    <div>
      {React.Children.map(children, (radio: ReactElement) =&gt;
        React.cloneElement(radio, {
          name,
          onChange,
          ...(isControlled ? { checked: value === radio.props.value } : {}),
        })
      )}
    </div>
  );
};

const marginPropNames = margin.propNames;

type Ref = HTMLInputElement;
export type RadioProps = MarginProps &amp; ComponentPropsWithRef&lt;'input'&gt;;

export const Radio: FC = forwardRef((props, forwardedRef) =&gt; {
  const { children, ...otherProps } = props;
  const systemProps = pick(otherProps, marginPropNames);
  const inputProps = omit(otherProps, marginPropNames);

  return (
    
      <input type="radio">
      
      {children &amp;&amp; {children}}
    
  );
github modulz / radix / packages / radix / src / components / Checkbox.tsx View on Github external
import React, { ComponentProps } from 'react';
import styled from 'styled-components';
import css from '@styled-system/css';
import omit from 'lodash.omit';
import pick from 'lodash.pick';
import { margin, MarginProps } from '@modulz/radix-system';

export type CheckboxProps = MarginProps &amp; ComponentProps&lt;'input'&gt;;

const marginPropNames = margin.propNames;

export const Checkbox = React.forwardRef(
  ({ children, ...props }, forwaredRef) =&gt; {
    const marginProps = pick(props, marginPropNames);
    const inputProps = omit(props, marginPropNames);

    return (
      
        <input type="checkbox">
        

@modulz/radix-system

Radix System Library

MIT
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages