Skip to content

Commit

Permalink
Merge pull request #1194 from Wizleap-Inc/feat/1193_text-button
Browse files Browse the repository at this point in the history
Feat(text-button): 新しいvariant: grayを追加する
  • Loading branch information
ichi-h authored Jan 22, 2024
2 parents ac3ea50 + ff94b94 commit 6326f96
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .changeset/ninety-rocks-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@wizleap-inc/wiz-ui-react": minor
"@wizleap-inc/wiz-ui-next": minor
"@wizleap-inc/wiz-ui-styles": minor
---

[#1193] Text Button の variant に "gray" 追加
9 changes: 9 additions & 0 deletions packages/styles/bases/text-button.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ export const textButtonStyle = styleVariants({
border: "none",
},
],
gray: [
baseTextButtonStyle,
{
background: THEME.color.gray[600],
color: THEME.color.white[800],
boxShadow: THEME.shadow.md,
border: "none",
},
],
});

export const textButtonDisabledStyle = style({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
},
variant: {
control: { type: "select" },
options: ["primary", "sub", "danger", "sub-danger"],
options: ["primary", "sub", "danger", "sub-danger", "gray"],
},
size: {
control: { type: "select" },
Expand Down Expand Up @@ -59,6 +59,8 @@ const TemplateVariant: StoryFn<typeof WizTextButton> = (args) => ({
<div>variant = danger</div>
<WizTextButton v-bind="args" @click="() => args.click" variant="sub-danger">保存する</WizTextButton>
<div>variant = sub-danger</div>
<WizTextButton v-bind="args" @click="() => args.click" variant="gray">保存する</WizTextButton>
<div>variant = gray</div>
</div>
`,
});
Expand Down Expand Up @@ -180,6 +182,8 @@ IconPosition.parameters = {
<div>variant = danger</div>
<WizTextButton v-bind="args" @click="click" :icon="WizIAdd" iconPosition="right" variant="sub-danger">保存する</WizTextButton>
<div>variant = sub-danger</div>
<WizTextButton v-bind="args" @click="click" :icon="WizIAdd" iconPosition="right" variant="gray">保存する</WizTextButton>
<div>variant = gray</div>
</template>
`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ interface Emits {
const props = defineProps({
variant: {
type: String as PropType<"primary" | "sub" | "danger" | "sub-danger">,
type: String as PropType<
"primary" | "sub" | "danger" | "sub-danger" | "gray"
>,
required: false,
default: "primary",
},
Expand Down Expand Up @@ -99,13 +101,14 @@ const emit = defineEmits<Emits>();
const onClick = () => props.disabled || emit("click");
const variantColor: Record<
"primary" | "sub" | "danger" | "sub-danger",
"primary" | "sub" | "danger" | "sub-danger" | "gray",
ColorKeys
> = {
primary: "white.800",
sub: "green.800",
danger: "white.800",
"sub-danger": "red.800",
gray: "white.800",
};
const iconSize: Record<"xs" | "sm" | "md" | "lg", FontSizeKeys> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ComponentProps, ForwardedRef, ReactNode, forwardRef } from "react";
import { TIcon, WizHStack, WizIcon } from "@/components";
import { BaseProps } from "@/types";
type Props = BaseProps & {
variant?: "primary" | "sub" | "danger" | "sub-danger";
variant?: "primary" | "sub" | "danger" | "sub-danger" | "gray";
disabled?: boolean;
rounded?: boolean;
expand?: boolean;
Expand All @@ -21,13 +21,14 @@ type Props = BaseProps & {
} & ComponentProps<"button">;

const variantColor: Record<
"primary" | "sub" | "danger" | "sub-danger",
"primary" | "sub" | "danger" | "sub-danger" | "gray",
ColorKeys
> = {
primary: "white.800",
sub: "green.800",
danger: "white.800",
"sub-danger": "red.800",
gray: "white.800",
};

const iconSize: Record<"xs" | "sm" | "md" | "lg", FontSizeKeys> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ export const Icon: Story = {
保存する
</WizTextButton>
<div>variant = sub-danger</div>
<WizTextButton {...args} variant="gray">
保存する
</WizTextButton>
<div>variant = sub-danger</div>
</div>
),
parameters: {
Expand Down Expand Up @@ -149,6 +153,10 @@ export const Variant: Story = {
保存する
</WizTextButton>
<div>variant = sub-danger</div>
<WizTextButton {...args} variant="gray">
保存する
</WizTextButton>
<div>variant = gray</div>
</div>
),
};
Expand Down

2 comments on commit 6326f96

@vercel
Copy link

@vercel vercel bot commented on 6326f96 Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wiz-ui-react – ./packages/wiz-ui-react

wiz-ui-react-git-main-wizleap.vercel.app
wiz-ui-react.vercel.app
wiz-ui-react-wizleap.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 6326f96 Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wiz-ui-next – ./packages/wiz-ui-next

wiz-ui-next-wizleap.vercel.app
wiz-ui-next.vercel.app
wiz-ui-next-git-main-wizleap.vercel.app

Please sign in to comment.