-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from storybookjs/improve-guided-tour
Improve guided tour
- Loading branch information
Showing
8 changed files
with
190 additions
and
171 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import { Button } from "./Button"; | ||
|
||
const meta: Meta<typeof Button> = { | ||
title: "Components/Button", | ||
component: Button, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof Button>; | ||
|
||
export const Default: Story = { | ||
args: { 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 |
---|---|---|
@@ -1,22 +1,42 @@ | ||
import React from "react"; | ||
import { styled } from "@storybook/theming"; | ||
import React, { FC } from "react"; | ||
|
||
export const buttonStyles: React.ComponentProps<"button">["style"] = { | ||
border: 0, | ||
cursor: "pointer", | ||
fontSize: 13, | ||
lineHeight: 1, | ||
padding: "9px 12px", | ||
backgroundColor: "#029CFD", | ||
borderRadius: 4, | ||
color: "#fff", | ||
fontWeight: 700, | ||
}; | ||
export interface ButtonProps { | ||
children: string; | ||
onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void; | ||
} | ||
|
||
export function Button(props: React.ComponentProps<"button">) { | ||
const style = { | ||
...buttonStyles, | ||
...(props.style || {}), | ||
}; | ||
const Container = styled.button` | ||
all: unset; | ||
border: 0; | ||
border-radius: 0.25rem; | ||
cursor: pointer; | ||
display: inline-flex; | ||
align-items: center; | ||
justify-content: center; | ||
padding: 0 0.75rem; | ||
background: ${({ theme }) => theme.color.secondary}; | ||
color: ${({ theme }) => theme.color.lightest}; | ||
height: 32px; | ||
font-size: 0.8125rem; | ||
font-weight: 700; | ||
font-family: ${({ theme }) => theme.typography.fonts.base}; | ||
transition: all 0.16s ease-in-out; | ||
text-decoration: none; | ||
return <button type="button" {...props} style={style} />; | ||
} | ||
&:hover { | ||
background-color: #0b94eb; | ||
} | ||
&:focus { | ||
box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.1); | ||
} | ||
`; | ||
|
||
export const Button: FC<ButtonProps> = ({ children, onClick, ...rest }) => { | ||
return ( | ||
<Container onClick={onClick} {...rest}> | ||
{children} | ||
</Container> | ||
); | ||
}; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.