Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionButtonコンポーネントのicon propsをnullableにした #1521

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thirty-rats-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ingred-ui": minor
---

to nullable icon in ActionButton
10 changes: 5 additions & 5 deletions src/components/ActionButton/ActionButton.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from "react";
import * as Styled from "./styled";
import { colors } from "../../styles/color";
import { Theme, useTheme } from "../../themes";
import Icon from "../Icon";
import { IconName } from "../Icon/Icon";
import Typography from "../Typography";
import { Theme, useTheme } from "../../themes";
import { colors } from "../../styles/color";
import * as Styled from "./styled";

const getNormalBackgroundColor = (theme: Theme) => ({
primary: theme.palette.background.hint,
Expand Down Expand Up @@ -33,7 +33,7 @@ const getTextColor = (theme: Theme) => ({
type ColorProp = "primary" | "warning";

export type ActionButtonProps = React.ComponentPropsWithoutRef<"button"> & {
icon: IconName;
icon?: IconName;
color?: ColorProp;
};

Expand Down Expand Up @@ -67,7 +67,7 @@ const ActionButton = React.forwardRef<HTMLButtonElement, ActionButtonProps>(
hoverBackgroundColor={hoverBackgroundColor}
disabled={disabled}
>
<Icon name={icon} color={textColor} />
{icon && <Icon name={icon} color={textColor} />}
{children && (
<Typography color={textColor} size="md">
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
exports[`ActionButton component testing ActionButton 1`] = `
<DocumentFragment>
<button
class="sc-bczRLJ hWIYcR"
class="sc-dkzDqf ia-DTMs"
>
<span
class="sc-gsnTZi ezZeqd"
class="sc-bczRLJ gJuzRf"
size="18"
>
<svg
Expand Down