Socket
Socket
Sign inDemoInstall

@donggle/layout-component

Package Overview
Dependencies
22
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @donggle/layout-component


Version published
Maintainers
2
Created

Readme

Source

동글의 레이아웃 컴포넌트

우아한테크코스 5기 프로젝트 동글


layout-component · NPM Version GitHub license

@donggle/layout-component 는 동글에서 사용하는 Drawer 컴포넌트를 담은 라이브러리입니다.

이 라이브러리는 내부적으로 styled-components를 이용하기 때문에, styled-components를 이용하고 있는 프로젝트에 적합합니다.

설치

@donggle/layout-componentnpm에 배포되어 있습니다.

다음 명령어를 통해 최신 버전을 설치할 수 있습니다.

npm i @donggle/layout-component

yarn을 사용하신다면:

yarn add @donggle/layout-component

사용법

Drawer

사이트 내 목적지 또는 계정 전환과 같은 앱 기능에 접근하는 통로를 담는 컴포넌트

Props
속성타입기본값
anchor'left', 'right', 'top', 'bottom''left'
openbooleanfalse
onCloseFunctionundefined
import { Container } from '@donggle/layout-component';

...
const [state, setState] = React.useState({
  top: false,
  left: false,
  bottom: false,
  right: false,
});

const toggleDrawer = (anchor: Anchor, open: boolean) => {
  setState({ ...state, [anchor]: open });
};

const list = (anchor: Anchor) => (
  <Flex direction="column">
    <button onClick={() => toggleDrawer(anchor, false)}>Woowacourse</button>
    <button onClick={() => toggleDrawer(anchor, false)}>Missions</button>
    <button onClick={() => toggleDrawer(anchor, false)}>Settings</button>
  </Flex>
);

return (
  <>
    {(['left', 'right', 'top', 'bottom'] as const).map((anchor) => (
      <React.Fragment key={anchor}>
        <button onClick={() => toggleDrawer(anchor, true)}>{anchor}</button>
        <Drawer anchor={anchor} open={state[anchor]} onClose={() => toggleDrawer(anchor, false)}>
          {list(anchor)}
        </Drawer>
      </React.Fragment>
    ))}
  </>
);
...

License

@donggle/layout-component is MIT licensed

FAQs

Last updated on 02 Nov 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc