0.19.0 • Published 2 years ago

@42world/design-core v0.19.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

0.17.2

2 years ago

0.17.3

2 years ago

0.18.1

2 years ago

0.18.2

2 years ago

0.18.3

2 years ago

0.18.0

2 years ago

0.17.1

2 years ago

0.15.4

2 years ago

0.15.5

2 years ago

0.15.6

2 years ago

0.15.7

2 years ago

0.11.0

2 years ago

0.11.1

2 years ago

0.13.0

2 years ago

0.11.2

2 years ago

0.11.3

2 years ago

0.15.0

2 years ago

0.15.1

2 years ago

0.17.0

2 years ago

0.15.2

2 years ago

0.15.3

2 years ago

0.3.0

2 years ago

0.9.0

2 years ago

0.3.5

2 years ago

0.9.1

2 years ago

0.5.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.7.0

2 years ago

0.5.2

2 years ago

0.3.4

2 years ago

0.5.1

2 years ago

0.3.3

2 years ago

0.12.0

2 years ago

0.14.0

2 years ago

0.14.1

2 years ago

0.16.0

2 years ago

0.10.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.8.1

2 years ago

0.8.0

2 years ago

0.2.6

2 years ago

0.2.3

2 years ago

0.4.0

2 years ago

0.2.2

2 years ago

0.6.1

2 years ago

0.2.5

2 years ago

0.6.0

2 years ago

0.2.4

2 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1-alpha.8

3 years ago

0.1.1-alpha.7

3 years ago

0.1.1-alpha.6

3 years ago

0.1.1-alpha.5

3 years ago

0.1.1-alpha.4

3 years ago

0.1.1-alpha.3

3 years ago

0.1.1-alpha.2

3 years ago

0.1.1-alpha.1

3 years ago

0.1.1

3 years ago