diff --git a/stylesheets/components/SystemMessage.scss b/stylesheets/components/SystemMessage.scss index 2f265af108bb..696df12fe12c 100644 --- a/stylesheets/components/SystemMessage.scss +++ b/stylesheets/components/SystemMessage.scss @@ -291,10 +291,31 @@ } &--error { - color: $color-accent-red; + .SystemMessage__contents::before { + @include light-theme { + background-color: $color-accent-red; + } + @include dark-theme { + background-color: $color-accent-red; + } + } + } + + &--danger { + @include light-theme { + color: $color-accent-red; + } + @include dark-theme { + color: $color-accent-red; + } .SystemMessage__contents::before { - background: $color-accent-red; + @include light-theme { + background-color: $color-accent-red; + } + @include dark-theme { + background-color: $color-accent-red; + } } } diff --git a/ts/components/conversation/CallingNotification.tsx b/ts/components/conversation/CallingNotification.tsx index 86314c15ba7f..ea70b5c1d278 100644 --- a/ts/components/conversation/CallingNotification.tsx +++ b/ts/components/conversation/CallingNotification.tsx @@ -5,7 +5,7 @@ import type { ReactNode } from 'react'; import React from 'react'; import { noop } from 'lodash'; -import { SystemMessage } from './SystemMessage'; +import { SystemMessage, SystemMessageKind } from './SystemMessage'; import { Button, ButtonSize, ButtonVariant } from '../Button'; import { MessageTimestamp } from './MessageTimestamp'; import type { LocalizerType } from '../../types/Util'; @@ -80,7 +80,7 @@ export const CallingNotification: React.FC = React.memo( } icon={icon} - isError={wasMissed} + kind={wasMissed ? SystemMessageKind.Danger : SystemMessageKind.Normal} /> ); } diff --git a/ts/components/conversation/SystemMessage.stories.tsx b/ts/components/conversation/SystemMessage.stories.tsx new file mode 100644 index 000000000000..30f87abee0da --- /dev/null +++ b/ts/components/conversation/SystemMessage.stories.tsx @@ -0,0 +1,51 @@ +// Copyright 2023 Signal Messenger, LLC +// SPDX-License-Identifier: AGPL-3.0-only + +import * as React from 'react'; +import { SystemMessage, SystemMessageKind } from './SystemMessage'; + +export default { + title: 'Components/Conversation/SystemMessage', +}; + +export function PlainSystemMessage(): JSX.Element { + return ( + + ); +} + +PlainSystemMessage.story = { + name: 'Plain', +}; + +export function DangerSystemMessage(): JSX.Element { + return ( + + ); +} + +DangerSystemMessage.story = { + name: 'Danger', +}; + +export function ErrorSystemMessage(): JSX.Element { + return ( + + ); +} + +ErrorSystemMessage.story = { + name: 'Error', +}; diff --git a/ts/components/conversation/SystemMessage.tsx b/ts/components/conversation/SystemMessage.tsx index bdbe013cb412..df90b99c199a 100644 --- a/ts/components/conversation/SystemMessage.tsx +++ b/ts/components/conversation/SystemMessage.tsx @@ -5,20 +5,30 @@ import type { ReactNode } from 'react'; import React, { forwardRef } from 'react'; import classNames from 'classnames'; +export enum SystemMessageKind { + Normal = 'Normal', + Danger = 'Danger', + Error = 'Error', +} + type PropsType = { icon: string; contents: ReactNode; button?: ReactNode; - isError?: boolean; + kind?: SystemMessageKind; }; export const SystemMessage = forwardRef( - function SystemMessageInner({ icon, contents, button, isError }, ref) { + function SystemMessageInner( + { icon, contents, button, kind = SystemMessageKind.Normal }, + ref + ) { return (