-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add changelog * crazy storybook * remove babel config * delete changel id * add babel config * success build * add trigger id * fix lint * success linaria build * ignore linaria cache * Reset CSS * add center component * add center tag * Add style * add button story * typing onclick * fix cyan color * add unsafe color * add minheight * remove storybook
- Loading branch information
1 parent
ff5f217
commit e717f51
Showing
35 changed files
with
722 additions
and
494 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules | ||
dist | ||
storybook-static | ||
.firebase | ||
.firebase | ||
.linaria-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](http://keepachangelog.com/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## [Unreleased] | ||
|
||
### Removed | ||
|
||
- Alerts component | ||
- badge component | ||
- gradation text component | ||
- outline text component | ||
- pager component | ||
- pill component | ||
|
||
### Changed | ||
|
||
- Improve performance | ||
- Remove CSS in JS library | ||
- update all package version | ||
- Improve readability | ||
|
||
## [0.0.37] | ||
|
||
### Added | ||
|
||
- alerts component | ||
- background component | ||
- badge component | ||
- blink component | ||
- button component | ||
- center component | ||
- gradation text component | ||
- outline text component | ||
- pager component | ||
- pill component | ||
- progress bar component | ||
- rotator component | ||
- typography component | ||
- zoom component | ||
- image component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Story } from "@storybook/react"; | ||
import { ComponentProps } from "react"; | ||
|
||
import { Button as Component } from "./index"; | ||
|
||
export default { | ||
title: "Button", | ||
component: Component, | ||
}; | ||
|
||
const Template: Story<ComponentProps<typeof Component>> = (args) => ( | ||
<Component {...args}>hello world!!</Component> | ||
); | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = {}; | ||
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
type: "primary", | ||
}; | ||
|
||
export const Warning = Template.bind({}); | ||
Warning.args = { | ||
type: "warning", | ||
}; | ||
|
||
export const Info = Template.bind({}); | ||
Info.args = { | ||
type: "info", | ||
}; | ||
|
||
export const Large = Template.bind({}); | ||
Large.args = { | ||
size: "large", | ||
}; | ||
|
||
export const Small = Template.bind({}); | ||
Small.args = { | ||
size: "small", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { FC } from "react"; | ||
|
||
import { Rainbow } from "../.."; | ||
import { | ||
BLACK, | ||
CYAN, | ||
GRAY, | ||
GREEN, | ||
RED, | ||
WHITE, | ||
YELLOW, | ||
} from "../../const/internal/color"; | ||
import { assertNever } from "../../util/internal/assert-never"; | ||
|
||
type Props = { | ||
type?: | ||
| "default" | ||
| "primary" | ||
| "info" | ||
| "success" | ||
| "warning" | ||
| "danger" | ||
| "inverse"; | ||
size?: "normal" | "large" | "small"; | ||
isDisable?: boolean; | ||
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void; | ||
__unsafe__style?: React.CSSProperties; | ||
}; | ||
|
||
const DEFAULT_DISABLE = false; | ||
|
||
export const Button: FC<Props> = ({ | ||
children, | ||
type, | ||
size, | ||
isDisable, | ||
onClick, | ||
__unsafe__style, | ||
}) => { | ||
let skinStyle: React.CSSProperties = {}; | ||
switch (type) { | ||
case "default": | ||
case undefined: | ||
skinStyle = { | ||
color: GRAY, | ||
}; | ||
break; | ||
case "primary": | ||
skinStyle = { | ||
color: WHITE, | ||
background: `#000 url(${Rainbow}) top left`, | ||
}; | ||
break; | ||
case "info": | ||
skinStyle = { | ||
color: WHITE, | ||
backgroundColor: CYAN, | ||
}; | ||
break; | ||
case "success": | ||
skinStyle = { | ||
color: WHITE, | ||
backgroundColor: GREEN, | ||
}; | ||
break; | ||
case "warning": | ||
skinStyle = { | ||
color: BLACK, | ||
backgroundColor: YELLOW, | ||
}; | ||
break; | ||
case "danger": | ||
skinStyle = { | ||
color: WHITE, | ||
backgroundColor: RED, | ||
}; | ||
break; | ||
case "inverse": | ||
skinStyle = { | ||
color: WHITE, | ||
backgroundColor: BLACK, | ||
}; | ||
break; | ||
default: | ||
assertNever(type); | ||
} | ||
|
||
let sizeStyle: React.CSSProperties = {}; | ||
switch (size) { | ||
case "normal": | ||
case undefined: | ||
sizeStyle = { | ||
padding: "4px 12px", | ||
fontSize: 16, | ||
}; | ||
break; | ||
case "small": | ||
sizeStyle = { | ||
padding: "2px 8px", | ||
fontSize: 12, | ||
}; | ||
break; | ||
case "large": | ||
sizeStyle = { | ||
padding: "12px 20px", | ||
fontSize: 20, | ||
}; | ||
break; | ||
default: | ||
assertNever(size); | ||
} | ||
return ( | ||
<button | ||
disabled={isDisable === undefined ? DEFAULT_DISABLE : isDisable} | ||
style={{ | ||
...sizeStyle, | ||
...skinStyle, | ||
...__unsafe__style, | ||
border: "6px ridge #bbb", | ||
cursor: "pointer", | ||
}} | ||
onClick={onClick} | ||
> | ||
{children} | ||
</button> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Story } from "@storybook/react"; | ||
import { ComponentProps } from "react"; | ||
|
||
import { Center as Component } from "./index"; | ||
|
||
export default { | ||
title: "Center", | ||
component: Component, | ||
}; | ||
|
||
const Template: Story<ComponentProps<typeof Component>> = (args) => ( | ||
<Component {...args} /> | ||
); | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
children: <p>hello world!!</p>, | ||
isHorizontal: true, | ||
isVertical: true, | ||
}; | ||
|
||
export const OnlyHorizontal = Template.bind({}); | ||
OnlyHorizontal.args = { | ||
children: <p>hello world!!</p>, | ||
isHorizontal: true, | ||
}; | ||
|
||
export const OnlyVertical = Template.bind({}); | ||
OnlyVertical.args = { | ||
children: <p>hello world!!</p>, | ||
isVertical: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { FC } from "react"; | ||
|
||
type Props = { | ||
isVertical?: boolean; | ||
isHorizontal?: boolean; | ||
__unsafe__style?: React.CSSProperties; | ||
}; | ||
|
||
export const Center: FC<Props> = (props) => ( | ||
<div | ||
style={{ | ||
display: "flex", | ||
alignItems: props.isVertical ? "center" : "inherit", | ||
justifyContent: props.isHorizontal ? "center" : "inherit", | ||
...props.__unsafe__style, | ||
}} | ||
> | ||
{props.children} | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.