Skip to content

Commit

Permalink
Prop name updated
Browse files Browse the repository at this point in the history
  • Loading branch information
vinu.ganesan committed Dec 21, 2023
1 parent 69925e4 commit 63a93a0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions example/src/components/UConfirmationButtonExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function UConfirmationButtonExample() {
</Typography>
</Grid>
<Grid item xs={12}>
<Typography variant="subtitle1">Confirmation popup variant</Typography>
<Typography variant="subtitle1">Confirm popup variant</Typography>
</Grid>
<Grid container item xs={12}>
<Grid item xs={12} sm={6} md={3}>
Expand All @@ -50,7 +50,7 @@ export default function UConfirmationButtonExample() {
onConfirm={handleDelete}
id={1}
buttonText="Delete"
confirmationVariant="popup"
confirmVariant="popup"
/>
</Grid>
<Grid item xs={12} sm={6} md={3}>
Expand Down Expand Up @@ -88,7 +88,7 @@ export default function UConfirmationButtonExample() {
buttonText="Delete"
variant="menuItem"
icon={null}
confirmationVariant="popup"
confirmVariant="popup"
/>
</Menu>
</Grid>
Expand All @@ -100,7 +100,7 @@ export default function UConfirmationButtonExample() {
confirmText="Are you sure you want to delete the item?"
buttonText="Delete"
variant="button"
confirmationVariant="popup"
confirmVariant="popup"
/>
</Grid>
<Grid item xs={12} sm={6} md={3}>
Expand All @@ -112,13 +112,13 @@ export default function UConfirmationButtonExample() {
variant="button"
confirmText="Are you sure you want to unlink the item?"
confirmActionText="Yes, unlink"
confirmationVariant="popup"
confirmVariant="popup"
icon={<LinkOffIcon />}
/>
</Grid>
</Grid>
<Grid item xs={12}>
<Typography variant="subtitle1">Confirmation menu variant</Typography>
<Typography variant="subtitle1">Confirm menu variant</Typography>
</Grid>
<Grid container item xs={12}>
<Grid item xs={12} sm={6} md={3}>
Expand Down
14 changes: 7 additions & 7 deletions src/components/UConfirmationButton/UConfirmationButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ export default function UConfirmationButton(props) {
confirmActionText,
cancelText,
buttonVariant,
confirmationVariant,
confirmVariant,
} = props
const [deleteAnchorEl, setDeleteAnchorEl] = useState(null)
const [openDialog, setOpenDialog] = useState(false)

const handleConfirm = e => {
onConfirm && onConfirm(e, id)
if (confirmationVariant === CONFIRMATION_VARIANTS.popup) {
if (confirmVariant === CONFIRMATION_VARIANTS.popup) {
setOpenDialog(false)
} else {
handleDeleteOptionClicked(e)
Expand All @@ -75,7 +75,7 @@ export default function UConfirmationButton(props) {
}

const handleClick = e => {
if (confirmationVariant === CONFIRMATION_VARIANTS.popup) {
if (confirmVariant === CONFIRMATION_VARIANTS.popup) {
setOpenDialog(true)
} else {
setDeleteAnchorEl(e.currentTarget)
Expand Down Expand Up @@ -118,7 +118,7 @@ export default function UConfirmationButton(props) {
</IconButton>
</Tooltip>
)}
{confirmationVariant === CONFIRMATION_VARIANTS.popup ? (
{confirmVariant === CONFIRMATION_VARIANTS.popup ? (
<Dialog id={`delete-confirmation-menu-${id}`} open={openDialog}>
<DialogContent>
<Typography variant="body1">{confirmText || ''}</Typography>
Expand Down Expand Up @@ -164,8 +164,8 @@ UConfirmationButton.propTypes = {
CONTROL_VARIANTS.icon,
CONTROL_VARIANTS.button,
]),
/** Confirmation variant: popup or menu */
confirmationVariant: PropTypes.oneOf([
/** Confirm variant: popup or menu */
confirmVariant: PropTypes.oneOf([
CONFIRMATION_VARIANTS.popup,
CONFIRMATION_VARIANTS.menu,
]),
Expand All @@ -192,5 +192,5 @@ UConfirmationButton.defaultProps = {
cancelText: 'No',
icon: <DeleteOutlinedIcon />,
buttonVariant: 'text',
confirmationVariant: 'menu',
confirmVariant: 'menu',
}
12 changes: 6 additions & 6 deletions src/components/UConfirmationButton/UConfirmationButton.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import MoreVertIcon from '@material-ui/icons/MoreVert'

<Grid container>
<Grid item xs={12}>
<Typography variant="subtitle1">Confirmation popup variant</Typography>
<Typography variant="subtitle1">Confirm popup variant</Typography>
</Grid>
<Grid container item xs={12}>
<Grid item xs={12} sm={6} md={3}>
Expand All @@ -37,7 +37,7 @@ import MoreVertIcon from '@material-ui/icons/MoreVert'
onConfirm={handleDelete}
id={1}
buttonText="Delete"
confirmationVariant="popup"
confirmVariant="popup"
/>
</Grid>
<Grid item xs={12} sm={6} md={3}>
Expand Down Expand Up @@ -75,7 +75,7 @@ import MoreVertIcon from '@material-ui/icons/MoreVert'
buttonText="Delete"
variant="menuItem"
icon={null}
confirmationVariant="popup"
confirmVariant="popup"
/>
</Menu>
</Grid>
Expand All @@ -87,7 +87,7 @@ import MoreVertIcon from '@material-ui/icons/MoreVert'
confirmText="Are you sure you want to delete the item?"
buttonText="Delete"
variant="button"
confirmationVariant="popup"
confirmVariant="popup"
/>
</Grid>
<Grid item xs={12} sm={6} md={3}>
Expand All @@ -99,13 +99,13 @@ import MoreVertIcon from '@material-ui/icons/MoreVert'
variant="button"
confirmText="Are you sure you want to unlink the item?"
confirmActionText="Yes, unlink"
confirmationVariant="popup"
confirmVariant="popup"
icon={<LinkOffIcon />}
/>
</Grid>
</Grid>
<Grid item xs={12}>
<Typography variant="subtitle1">Confirmation menu variant</Typography>
<Typography variant="subtitle1">Confirm menu variant</Typography>
</Grid>
<Grid container item xs={12}>
<Grid item xs={12} sm={6} md={3}>
Expand Down

0 comments on commit 63a93a0

Please sign in to comment.