Skip to content
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
2 changes: 1 addition & 1 deletion docs/src/pages/components/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
rules: {
// useful for interactions feedback
'no-alert': 'off',
'no-console': ['off', { allow: ['info'] }],
// not very friendly to prop forwarding
'react/jsx-handler-names': 'off',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const useStyles = makeStyles(theme => ({

function handleClick(event) {
event.preventDefault();
alert('You clicked a breadcrumb.');
console.info('You clicked a breadcrumb.');
}

export default function CollapsedBreadcrumbs() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const useStyles = makeStyles((theme: Theme) =>

function handleClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
event.preventDefault();
alert('You clicked a breadcrumb.');
console.info('You clicked a breadcrumb.');
}

export default function CollapsedBreadcrumbs() {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/breadcrumbs/CustomSeparator.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const useStyles = makeStyles(theme => ({

function handleClick(event) {
event.preventDefault();
alert('You clicked a breadcrumb.');
console.info('You clicked a breadcrumb.');
}

export default function CustomSeparator() {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/breadcrumbs/CustomSeparator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const useStyles = makeStyles((theme: Theme) =>

function handleClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
event.preventDefault();
alert('You clicked a breadcrumb.');
console.info('You clicked a breadcrumb.');
}

export default function CustomSeparator() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const StyledBreadcrumb = withStyles(theme => ({

function handleClick(event) {
event.preventDefault();
alert('You clicked a breadcrumb.');
console.info('You clicked a breadcrumb.');
}

const useStyles = makeStyles(theme => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const StyledBreadcrumb = withStyles((theme: Theme) => ({

function handleClick(event: React.MouseEvent<Element, MouseEvent>) {
event.preventDefault();
alert('You clicked a breadcrumb.');
console.info('You clicked a breadcrumb.');
}

const useStyles = makeStyles((theme: Theme) =>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/breadcrumbs/IconBreadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const useStyles = makeStyles(theme => ({

function handleClick(event) {
event.preventDefault();
alert('You clicked a breadcrumb.');
console.info('You clicked a breadcrumb.');
}

export default function IconBreadcrumbs() {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/breadcrumbs/IconBreadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const useStyles = makeStyles((theme: Theme) =>

function handleClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
event.preventDefault();
alert('You clicked a breadcrumb.');
console.info('You clicked a breadcrumb.');
}

export default function IconBreadcrumbs() {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/breadcrumbs/SimpleBreadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const useStyles = makeStyles(theme => ({

function handleClick(event) {
event.preventDefault();
alert('You clicked a breadcrumb.');
console.info('You clicked a breadcrumb.');
}

export default function SimpleBreadcrumbs() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const useStyles = makeStyles((theme: Theme) =>

function handleClick(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
event.preventDefault();
alert('You clicked a breadcrumb.');
console.info('You clicked a breadcrumb.');
}

export default function SimpleBreadcrumbs() {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/buttons/SplitButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function SplitButton() {
const [selectedIndex, setSelectedIndex] = React.useState(1);

const handleClick = () => {
alert(`You clicked ${options[selectedIndex]}`);
console.info(`You clicked ${options[selectedIndex]}`);
};

const handleMenuItemClick = (event, index) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/buttons/SplitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function SplitButton() {
const [selectedIndex, setSelectedIndex] = React.useState(1);

const handleClick = () => {
alert(`You clicked ${options[selectedIndex]}`);
console.info(`You clicked ${options[selectedIndex]}`);
};

const handleMenuItemClick = (
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/chips/Chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export default function Chips() {
const classes = useStyles();

const handleDelete = () => {
alert('You clicked the delete icon.');
console.info('You clicked the delete icon.');
};

const handleClick = () => {
alert('You clicked the Chip.');
console.info('You clicked the Chip.');
};

return (
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/chips/Chips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export default function Chips() {
const classes = useStyles();

const handleDelete = () => {
alert('You clicked the delete icon.');
console.info('You clicked the delete icon.');
};

const handleClick = () => {
alert('You clicked the Chip.');
console.info('You clicked the Chip.');
};

return (
Expand Down
7 changes: 1 addition & 6 deletions docs/src/pages/components/chips/ChipsArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ export default function ChipsArray() {
]);

const handleDelete = chipToDelete => () => {
if (chipToDelete.label === 'React') {
alert('Why would you want to delete React?! :)');
return;
}

setChipData(chips => chips.filter(chip => chip.key !== chipToDelete.key));
};

Expand All @@ -49,7 +44,7 @@ export default function ChipsArray() {
key={data.key}
icon={icon}
label={data.label}
onDelete={handleDelete(data)}
onDelete={data.label === 'React' ? undefined : handleDelete(data)}
className={classes.chip}
/>
);
Expand Down
7 changes: 1 addition & 6 deletions docs/src/pages/components/chips/ChipsArray.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ export default function ChipsArray() {
]);

const handleDelete = (chipToDelete: ChipData) => () => {
if (chipToDelete.label === 'React') {
alert('Why would you want to delete React?! :)');
Copy link
Member

Choose a reason for hiding this comment

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

This one might be the only one it the code base that is justified. Without, it's unclear why clicking the delete button does nothing for React while it removes the other tags.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll rewrite this so it isn't handled in the first place. In the end why mark a chip as deletable if it isn't?

Copy link
Member

Choose a reason for hiding this comment

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

Right 👌

return;
}

setChipData(chips => chips.filter(chip => chip.key !== chipToDelete.key));
};

Expand All @@ -56,7 +51,7 @@ export default function ChipsArray() {
key={data.key}
icon={icon}
label={data.label}
onDelete={handleDelete(data)}
onDelete={data.label === 'React' ? undefined : handleDelete(data)}
className={classes.chip}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/chips/ChipsPlayground.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function ChipsPlayground(props) {
};

const handleDeleteExample = () => {
alert('You clicked the delete icon.');
console.info('You clicked the delete icon.');
};

const colorToCode = color !== 'default' ? `color="${color}" ` : '';
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/chips/OutlinedChips.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export default function OutlinedChips() {
const classes = useStyles();

const handleDelete = () => {
alert('You clicked the delete icon.');
console.info('You clicked the delete icon.');
};

const handleClick = () => {
alert('You clicked the Chip.');
console.info('You clicked the Chip.');
};

return (
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/chips/OutlinedChips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export default function OutlinedChips() {
const classes = useStyles();

const handleDelete = () => {
alert('You clicked the delete icon.');
console.info('You clicked the delete icon.');
};

const handleClick = () => {
alert('You clicked the Chip.');
console.info('You clicked the Chip.');
};

return (
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/chips/SmallChips.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export default function SmallChips() {
const classes = useStyles();

const handleDelete = () => {
alert('You clicked the delete icon.');
console.info('You clicked the delete icon.');
};

const handleClick = () => {
alert('You clicked the Chip.');
console.info('You clicked the Chip.');
};

return (
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/chips/SmallChips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export default function SmallChips() {
const classes = useStyles();

const handleDelete = () => {
alert('You clicked the delete icon.');
console.info('You clicked the delete icon.');
};

const handleClick = () => {
alert('You clicked the Chip.');
console.info('You clicked the Chip.');
};

return (
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/chips/SmallOutlinedChips.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export default function SmallOutlinedChips() {
const classes = useStyles();

const handleDelete = () => {
alert('You clicked the delete icon.');
console.info('You clicked the delete icon.');
};

const handleClick = () => {
alert('You clicked the Chip.');
console.info('You clicked the Chip.');
};

return (
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/chips/SmallOutlinedChips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export default function SmallOutlinedChips() {
const classes = useStyles();

const handleDelete = () => {
alert('You clicked the delete icon.');
console.info('You clicked the delete icon.');
};

const handleClick = () => {
alert('You clicked the Chip.');
console.info('You clicked the Chip.');
};

return (
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/links/ButtonLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function ButtonLink() {
component="button"
variant="body2"
onClick={() => {
alert("I'm a button.");
console.info("I'm a button.");
}}
>
Button Link
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/links/ButtonLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function ButtonLink() {
component="button"
variant="body2"
onClick={() => {
alert("I'm a button.");
console.info("I'm a button.");
}}
>
Button Link
Expand Down