Skip to content

Commit

Permalink
Make Alert title optional (#86) (#89)
Browse files Browse the repository at this point in the history
* Make title optional

* Without title story

* Fix link
  • Loading branch information
Cloud11PL committed Nov 25, 2021
1 parent a5433f1 commit 67cb115
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/Alert/Alert.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Typography from "@material-ui/core/Typography";
import { Link, Typography } from "@material-ui/core";
import { Meta, Story } from "@storybook/react";
import React from "react";

Expand Down Expand Up @@ -34,6 +34,15 @@ export const Custom: Story = () => (
</AlertBase>
);

export const WithoutTitle: Story = () => (
<Alert close={false} variant="info">
<Typography>
Gift cards will appear after their order is fullfilled.{" "}
<Link>View Orders with Gift Cards</Link>
</Typography>
</Alert>
);

export default {
title: "Alert",
} as Meta;
4 changes: 2 additions & 2 deletions src/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import useStyles from "./styles";

export interface AlertProps extends AlertBaseProps {
close?: boolean;
title: string;
title?: string;
}
const Icon: React.FC<{ variant: AlertVariant }> = ({ variant }) => {
switch (variant) {
Expand Down Expand Up @@ -47,7 +47,7 @@ export const Alert: React.FC<AlertProps> = ({
</div>
<div className={classes.content}>
<div className={classes.titleBar}>
<Typography variant="h5">{title}</Typography>
{title && <Typography variant="h5">{title}</Typography>}
{close && (
<IconButton
className={clsx(classes.close, {
Expand Down

0 comments on commit 67cb115

Please sign in to comment.