mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-17 18:09:09 +00:00
chore: restructure project into yarn workspaces, remove next
This commit is contained in:
parent
49e308507e
commit
8d06327c03
266 changed files with 16466 additions and 3350 deletions
28
packages/design-system/atoms/fader/Fader.stories.tsx
Normal file
28
packages/design-system/atoms/fader/Fader.stories.tsx
Normal file
|
@ -0,0 +1,28 @@
|
|||
import { Button } from '@roleypoly/design-system/atoms/button';
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import * as React from 'react';
|
||||
import { FaderOpacity, FaderSlide } from './Fader';
|
||||
|
||||
export default {
|
||||
title: 'Atoms/Fader',
|
||||
component: FaderSlide,
|
||||
args: {
|
||||
isVisible: true,
|
||||
},
|
||||
};
|
||||
|
||||
export const Opacity = (args) => {
|
||||
return (
|
||||
<FaderOpacity {...args}>
|
||||
<Button onClick={action('onClick')}>Click me!</Button>
|
||||
</FaderOpacity>
|
||||
);
|
||||
};
|
||||
|
||||
export const Slide = (args) => {
|
||||
return (
|
||||
<FaderSlide {...args}>
|
||||
<Button onClick={action('onClick')}>Click me!</Button>
|
||||
</FaderSlide>
|
||||
);
|
||||
};
|
35
packages/design-system/atoms/fader/Fader.tsx
Normal file
35
packages/design-system/atoms/fader/Fader.tsx
Normal file
|
@ -0,0 +1,35 @@
|
|||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
export type FaderProps = {
|
||||
isVisible: boolean;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
const FaderOpacityStyled = styled.div<Pick<FaderProps, 'isVisible'>>`
|
||||
opacity: ${(props) => (props.isVisible ? 1 : 0)};
|
||||
pointer-events: ${(props) => (props.isVisible ? 'unset' : 'none')};
|
||||
transition: opacity 0.35s ease-in-out;
|
||||
`;
|
||||
|
||||
export const FaderOpacity = (props: FaderProps) => {
|
||||
return (
|
||||
<FaderOpacityStyled isVisible={props.isVisible}>
|
||||
{props.children}
|
||||
</FaderOpacityStyled>
|
||||
);
|
||||
};
|
||||
|
||||
const FaderSlideStyled = styled.div<Pick<FaderProps, 'isVisible'>>`
|
||||
max-height: ${(props) => (props.isVisible ? '4em' : '0')};
|
||||
pointer-events: ${(props) => (props.isVisible ? 'unset' : 'none')};
|
||||
transition: max-height 0.35s ease-in-out;
|
||||
overflow: hidden;
|
||||
transform: translateZ(0);
|
||||
`;
|
||||
|
||||
export const FaderSlide = (props: FaderProps) => {
|
||||
return (
|
||||
<FaderSlideStyled isVisible={props.isVisible}>{props.children}</FaderSlideStyled>
|
||||
);
|
||||
};
|
1
packages/design-system/atoms/fader/index.ts
Normal file
1
packages/design-system/atoms/fader/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export * from './Fader';
|
Loading…
Add table
Add a link
Reference in a new issue