fix(Button): redesign of existing Button component for consistency (#3473)

This commit is contained in:
Joe Boccanfuso authored and GitHub committed 2023-06-15 12:58:21 -04:00
1 parent 3dce70e624
commit cc73f15c8c
47 files changed
+738 -397

No files matched your search

+6 -5
View File
@@ -2,7 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import Button from '../Button';
import Button, { ButtonEnums } from '../Button';
const Footer = ({ actions, className, onSubmit, value }) => {
const flex = 'flex items-center justify-end';
@@ -12,7 +12,6 @@ const Footer = ({ actions, className, onSubmit, value }) => {
<div className={classNames(flex, padding, className)}>
{actions.map((action, index) => {
const isFirst = index === 0;
const isPrimary = action.type === 'primary';
const onClickHandler = event => onSubmit({ action, value, event });
@@ -20,9 +19,8 @@ const Footer = ({ actions, className, onSubmit, value }) => {
<Button
key={index}
className={classNames({ 'ml-2': !isFirst }, action.classes)}
color={isPrimary ? 'primary' : undefined}
type={action.type}
onClick={onClickHandler}
style={{ transition: 'all .15s ease', height: 34 }}
>
{action.text}
</Button>
@@ -42,7 +40,10 @@ Footer.propTypes = {
id: PropTypes.string.isRequired,
text: PropTypes.string.isRequired,
value: PropTypes.any,
type: PropTypes.oneOf(['primary', 'secondary', 'cancel']).isRequired,
type: PropTypes.oneOf([
ButtonEnums.type.primary,
ButtonEnums.type.secondary,
]).isRequired,
classes: PropTypes.arrayOf(PropTypes.string),
})
).isRequired,