Skip to content
Open
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
7 changes: 5 additions & 2 deletions src/components/core/button/primary-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ const sizeClasses = {
l: 'px-4 py-3 text-base leading-[1.5]',
};

const PrimaryButton = ({ size = 'sm', className, children, ...props }) => {
const PrimaryButton = React.forwardRef(({ size = 'sm', className, children, ...props }, ref) => {
return (
<button
ref={ref}
type="button"
className={cn(
'flex items-center justify-center bg-primary text-white rounded-lg',
Expand All @@ -24,7 +25,9 @@ const PrimaryButton = ({ size = 'sm', className, children, ...props }) => {
{children}
</button>
);
};
});

PrimaryButton.displayName = 'PrimaryButton';

PrimaryButton.propTypes = {
size: PropTypes.oneOf(['sm', 'l']),
Expand Down
9 changes: 6 additions & 3 deletions src/components/core/button/secondary-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ const sizeClasses = {
l: 'px-4 py-3 text-base leading-[1.5]',
};

const SecondaryButton = ({ size = 'sm', className, children, ...props }) => {
const SecondaryButton = React.forwardRef(({ size = 'sm', className, children, ...props }, ref) => {
return (
<button
ref={ref}
type="button"
className={cn(
'flex items-center justify-center text-text-primary border border-border-main rounded-lg',
'flex items-center justify-center bg-white text-text-primary border border-border-main rounded-lg',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

bg-white 跟 forwardRef 原題無關,但順便修。

'hover:bg-gray-50',
'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary',
'disabled:bg-bg-disabled disabled:text-text-disabled disabled:border disabled:border-text-secondary disabled:cursor-not-allowed',
Expand All @@ -24,7 +25,9 @@ const SecondaryButton = ({ size = 'sm', className, children, ...props }) => {
{children}
</button>
);
};
});

SecondaryButton.displayName = 'SecondaryButton';

SecondaryButton.propTypes = {
size: PropTypes.oneOf(['sm', 'l']),
Expand Down
9 changes: 6 additions & 3 deletions src/components/core/button/tertiary-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ const sizeClasses = {
l: 'px-4 py-3 text-base leading-[1.5]',
};

const TertiaryButton = ({ size = 'sm', className, children, ...props }) => {
const TertiaryButton = React.forwardRef(({ size = 'sm', className, children, ...props }, ref) => {
return (
<button
ref={ref}
type="button"
className={cn(
'flex items-center justify-center text-primary rounded-lg',
'flex items-center justify-center bg-white text-primary rounded-lg',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

bg-white 跟 forwardRef 原題無關,但順便修。

'hover:text-blue-800',
'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary',
'disabled:bg-bg-disabled disabled:text-text-disabled disabled:border disabled:border-text-secondary disabled:cursor-not-allowed',
Expand All @@ -24,7 +25,9 @@ const TertiaryButton = ({ size = 'sm', className, children, ...props }) => {
{children}
</button>
);
};
});

TertiaryButton.displayName = 'TertiaryButton';

TertiaryButton.propTypes = {
size: PropTypes.oneOf(['sm', 'l']),
Expand Down