Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
glassonion1 committed May 31, 2024
1 parent f41c76d commit 4200692
Show file tree
Hide file tree
Showing 15 changed files with 729 additions and 54 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sakura-ui/sakura-ui",
"version": "0.1.20",
"version": "0.1.21",
"keywords": [],
"author": "glassonion1",
"homepage": "https://github.com/glassonion1/sakura-ui",
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sakura-ui/config",
"version": "0.1.10",
"version": "0.1.11",
"description": "",
"keywords": [],
"author": "glassonion1",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sakura-ui/core",
"version": "0.1.37",
"version": "0.1.38",
"description": "",
"keywords": [],
"author": "glassonion1",
Expand Down
12 changes: 9 additions & 3 deletions packages/core/src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { cx } from '../libs/cx'
import { ComponentWithAs } from '../types/component'
import { forwardRef } from '../libs/forward-ref'
import { base, getVariantStyle, getSizeStyle } from './buttonStyle'
import {
type ButtonVariant,
type ButtonSize,
base,
getVariantStyle,
getSizeStyle
} from './buttonStyle'

export interface ButtonProps {
variant?: 'primary' | 'secondary'
size?: 'lg' | 'md' | 'sm' | 'xs'
variant?: ButtonVariant
size?: ButtonSize
}

export const Button: ComponentWithAs<'button', ButtonProps> = forwardRef(
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export const CardHeader = (props: CardHeaderProps) => {
const style = `
text-base
font-medium
first:pt-4
last:pb-4
px-6
`
Expand Down
34 changes: 24 additions & 10 deletions packages/core/src/components/buttonStyle.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary'
export type ButtonSize = 'lg' | 'md' | 'sm' | 'xs'

export const base = `
inline-block
text-button
Expand Down Expand Up @@ -39,18 +42,25 @@ const secondary = `
disabled:bg-transparent
`

const styles: { [key: string]: string } = {
primary: primary,
secondary: secondary
}
const tertiary = `
bg-transparent
text-blue-900
underline
hover:bg-blue-200
hover:text-blue-1000
active:bg-blue-300
active:text-blue-1200
disabled:bg-transparent
disabled:text-solid-grey-420
`

export const getVariantStyle = (variant: 'primary' | 'secondary') => {
return styles[variant]
const styles: { [key in ButtonVariant]: string } = {
primary: primary,
secondary: secondary,
tertiary: tertiary
}

const params: {
[key: string]: string
} = {
const params: { [key in ButtonSize]: string } = {
lg: `
p-4
text-button
Expand Down Expand Up @@ -79,6 +89,10 @@ const params: {
`
}

export const getSizeStyle = (size: 'lg' | 'md' | 'sm' | 'xs') => {
export const getVariantStyle = (variant: ButtonVariant) => {
return styles[variant]
}

export const getSizeStyle = (size: ButtonSize) => {
return params[size]
}
2 changes: 1 addition & 1 deletion packages/forms/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sakura-ui/forms",
"version": "0.1.12",
"version": "0.1.13",
"description": "",
"keywords": [],
"author": "glassonion1",
Expand Down
47 changes: 47 additions & 0 deletions packages/tailwind-theme-plugin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@sakura-ui/tailwind-theme-plugin",
"version": "0.0.1",
"description": "",
"keywords": [],
"author": "glassonion1",
"homepage": "https://github.com/glassonion1/sakura-ui",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com:glassonion1/sakura-ui.git",
"directory": "packages/config"
},
"license": "MIT",
"type": "module",
"main": "dist/index.cjs.js",
"types": "dist/types/index.d.ts",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"require": "./dist/index.cjs.js",
"import": "./dist/index.es.js"
}
},
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"lint": "run-s lint:*",
"lint:eslint": "eslint . --ext .ts,.tsx --fix",
"lint:prettier": "prettier --write --ignore-path .gitignore './src/*.ts'",
"prebuild": "rimraf dist",
"build": "run-p build:*",
"build:scripts": "vite build",
"build:types": "tsc && tsc-alias",
"test": "vitest"
},
"peerDependencies": {
"tailwindcss": "^3.2.7"
},
"devDependencies": {
"@digital-go-jp/design-tokens": "^0.1.6",
"autoprefixer": "^10.4.17",
"postcss": "^8.4.35",
"tailwindcss": "^3.4.1"
}
}
Loading

0 comments on commit 4200692

Please sign in to comment.