0.19.0 • Published 10 months ago

@42world/design-core v0.19.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

42World Design System

This is a design system for 42World.

Usage

install @42world/design-core package

yarn add @42world/design-core

import component from @42world/design-core package

import '@42world/design-core/style.css';
import { Button } from '@42world/design-core';

export default function App() {
  return <Button>Button</Button>;
}

Development

  • yarn dev This runs a local web server with the built code.
  • yarn build This builds the code in dist.

Open http://localhost:6006 in your browser to see the Storybook.

Open Framer, create a code file and paste the following:

import { Text } from 'http://127.0.0.1:8000/components/Text/Text.framer.js';

export default Text as React.ComponentType;

Code Conventions

Avoid using export default in every component file

// as-is
export default function Button() {
  return <button>Button</button>;
}

// to-be
export function Button() {
  return <button>Button</button>;
}

Avoid using React.FC type

// as-is
export const Button: React.FC = () => {
  return <button>Button</button>;
};

// to-be
export function Button() {
  return <button>Button</button>;
}

Avoid using React. prefix

// as-is
export function Button() {
  const [count, setCount] = React.useState(0);
}

// to-be
export function Button() {
  const [count, setCount] = useState(0);
}

you must create Component.framer.ts file for every component file. This file will be used to define property controls for the component in Framer.

  • we recommend to use applyFramerProperties function in common/framer folder. This function checks type more strictly than addPropertyControls function.
import { ControlType } from "framer"
import { applyFramerProperties } from '../../common/framer'
import { themeProperty } from '../../common/property'
import { Button } from "./Button"

applyFramerProperties(Button, {
  title: {
    title: "Title",
    type: ControlType.String,
    defaultValue: "Title",
  },
  ...
})

Please write comment for every prop in every component file.

type Props = {
  /**
   * 테마
   */
  theme: Theme;

  /**
   * 타이틀
   */
  title: string;

  ...
}

Please write name and @author in every component function.

/**
 * Button
 *
 * @author 42World
 */
export function Button() {
  return <button>Button</button>;
}

Generating template

You can use yarn template command to easily generate component template files(index.ts, Component.stories.ts, Component.framer.tsx, Component.tsx) at once.

If you run yarn template command, a prompt asking "What is your component name?" will be printed. Give your component name, and template files will be generated.

0.19.0

10 months ago

0.17.2

10 months ago

0.17.3

10 months ago

0.18.1

10 months ago

0.18.2

10 months ago

0.18.3

10 months ago

0.18.0

10 months ago

0.17.1

11 months ago

0.15.4

11 months ago

0.15.5

11 months ago

0.15.6

11 months ago

0.15.7

11 months ago

0.11.0

11 months ago

0.11.1

11 months ago

0.13.0

11 months ago

0.11.2

11 months ago

0.11.3

11 months ago

0.15.0

11 months ago

0.15.1

11 months ago

0.17.0

11 months ago

0.15.2

11 months ago

0.15.3

11 months ago

0.3.0

11 months ago

0.9.0

11 months ago

0.3.5

11 months ago

0.9.1

11 months ago

0.5.0

11 months ago

0.3.2

11 months ago

0.3.1

11 months ago

0.7.0

11 months ago

0.5.2

11 months ago

0.3.4

11 months ago

0.5.1

11 months ago

0.3.3

11 months ago

0.12.0

11 months ago

0.14.0

11 months ago

0.14.1

11 months ago

0.16.0

11 months ago

0.10.0

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.8.1

11 months ago

0.8.0

11 months ago

0.2.6

11 months ago

0.2.3

11 months ago

0.4.0

11 months ago

0.2.2

11 months ago

0.6.1

11 months ago

0.2.5

11 months ago

0.6.0

11 months ago

0.2.4

11 months ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1-alpha.8

1 year ago

0.1.1-alpha.7

1 year ago

0.1.1-alpha.6

1 year ago

0.1.1-alpha.5

1 year ago

0.1.1-alpha.4

1 year ago

0.1.1-alpha.3

1 year ago

0.1.1-alpha.2

1 year ago

0.1.1-alpha.1

1 year ago

0.1.1

1 year ago