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
3 changes: 2 additions & 1 deletion src/stories/notifications/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ interface NotificationStoryProps {
const defaultArgs: NotificationStoryProps = {
notificationArgs: {
type: "info",
message: "Action completed",
message: "Action completed for this kind of notification.",
onClose: () => alert("Close"),
closeText: "Close notification",
},
toastProviderArgs: {
limit: 5,
Expand Down
35 changes: 32 additions & 3 deletions src/stories/notifications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const UgAnchor = styled(Anchor).attrs<{
${(props) => retrieveComponentStyles(CLOSE_COMPONENT_ID, props)};
`;

const UgTitle = styled(Title).attrs<{
const UgTitle = styled(Title).attrs<{
"data-custom-id"?: string
}>((props) => ({
"data-custom-id": props["data-custom-id"] ?? TITLE_COMPONENT_ID,
Expand All @@ -59,6 +59,36 @@ const UgNotification = styled(ZendeskNotification)<NotificationArgs>`
}

${(props) => retrieveComponentStyles(NOTIFICATION_COMPONENT_ID, props)};

@media screen and (max-width: ${({ theme }) => theme.breakpoints.sm}) {
flex-direction: column;
padding: ${({ theme }) => theme.space.md};
width: 300px; // Set a fixed width for better mobile appearance
white-space: normal;
justify-content: center;

> svg {
display: none;
}

${({ closeText, theme }) => !closeText && `
a[data-custom-id="notifications.notification.close"] {
margin: 0;
position: absolute;
top: ${theme.space.xxs};
right: ${theme.space.xxs};
}
`}

${UgTitle} {
text-align: center;
}

${UgAnchor} {
margin: auto;
margin-top: ${({ theme }) => theme.space.sm};
}
}
`;

/**
Expand All @@ -68,7 +98,6 @@ const UgNotification = styled(ZendeskNotification)<NotificationArgs>`
- For a passive status update about user or system activity
*/
const Notification = ({
closeText,
message,
onClose,
type,
Expand All @@ -81,7 +110,7 @@ const Notification = ({
{message}
</UgTitle>
<UgAnchor type={type} isPrimary={isPrimary} onClick={onClose}>
{closeText ?? <UgClose />}
{props.closeText ?? <UgClose />}
</UgAnchor>
</UgNotification>
);
Expand Down