0.1.10 • Published 1 year ago

@solvlab/ui v0.1.10

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

SolvUI

应用类库

开发/设计规范

目录结构

  • src

    • assets

      存放公共静态文件,eg: css | svg

    • components

      UI 组件, 组件名采用驼峰命名法(首字母大写),eg: Button

      • common>styles.tsx

        公共 tailwindcss class

    • hooks

      公共处理 hook

    • stories

      test: 生成 UI 组件 doc

    • theme

      主题文件配置

    • index.ts

      组件库入口

主题 Color 命名与使用规范

序号代表
1App backgroundApp 背景色
2Subtle background微差异 背景色
3UI element backgroundUI 元素 背景色
4Hovered UI element background悬停的 UI 元素 背景色
5Active / Selected UI element background活动/选定的 UI 元素 背景色
6Subtle borders and separators边界/分隔符 颜色
7UI element border and focus ringsUI 元素 边框色
8Hovered UI element border悬停的 UI 元素 边框色
9Solid backgrounds纯色背景
10Hovered solid backgrounds悬停的纯色背景
11Low-contrast text低对比度文本
12High-contrast text高对比度文本

Dev

  • dev | test
pnpm sb
  • build
pnpm build

Use

Install

yarn add @solvprotocol/ui

pnpm i @solvprotocol/ui

npm i @solvprotocol/ui
  • Import css
import 'solvprotocol/ui/dist/index.css'
import 'solvprotocol/ui/dist/theme/index.css'
  • Import components
import { Button } from '@solvprotocol/ui'

Custom theme

  • Use css variable
@import '@solvlab/ui/dist/index.css';
@import '@solvlab/ui/dist/theme/index.css';

/* value = hsl */
:root {
  --solv-purple3: 240, 100%, 50%;
}
/* dark theme */
.dark-theme {
  --solv-purple3: 240, 100%, 20%;
}
  • Use tailwindcss.config.js
module.exports = {
  content: ['node_modules/@solvlab/ui/dist/**/*.js'],
  theme: {
    extend: {
      colors: {
        sui: {
          theme3: 'color value',
        },
      },
      spacing: {
        // eg
        'sui-4': '14px',
      },
      fontSize: {
        // eg
        'sui-base': '14px',
      },
    },
  },
}
0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago