Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Make MessageProps extend BoxProps #2465

Merged
merged 5 commits into from
Nov 23, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Changed

- `Message`: Make `MessageProps` extend the `BoxProps` and make `title` property optional ([@kristofcolpaert](https://github.com/kristofcolpaert)) in [#2465](https://github.com/teamleadercrm/ui/pull/2465))
- `Dialog`: Added z-index to scroll shadow to make sure it appears above inner elements ([@BeirlaenAaron](https://github.com/BeirlaenAaron)) in ([#2463](https://github.com/teamleadercrm/ui/pull/2463))

### Deprecated
Expand Down
6 changes: 3 additions & 3 deletions src/components/message/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
IconCloseMediumOutline,
IconWarningBadgedMediumFilled,
} from '@teamleader/ui-icons';
import Box from '../box';
import Box, { BoxProps } from '../box';
import Button from '../button';
import ButtonGroup from '../buttonGroup';
import Icon from '../icon';
Expand Down Expand Up @@ -52,7 +52,7 @@ const iconMap = {
warning: IconWarningBadgedMediumFilled,
};

export interface MessageProps {
export interface MessageProps extends Omit<BoxProps, 'children'> {
/** The content to display inside the message. */
children: React.ReactNode;
/** If true, the message will be rendered inline instead of taking full width. */
Expand All @@ -68,7 +68,7 @@ export interface MessageProps {
/** A status type to determine color and icon */
status?: Status;
/** The message title */
title: React.ReactNode;
title?: React.ReactNode;
}

const Message: GenericComponent<MessageProps> = ({
Expand Down
9 changes: 9 additions & 0 deletions src/components/message/message.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,12 @@ export const WithStatus = () => (
</TextBody>
</Message>
);

export const WithoutTitle = () => (
<Message status="info">
<TextBody color="teal">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam <Link inherit={false}>nonumy eirmod</Link>{' '}
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
</TextBody>
</Message>
);