From 7869ce9d4981e5ce428aef07bed9e99ca7506f47 Mon Sep 17 00:00:00 2001 From: David Cho-Lerat Date: Wed, 18 Sep 2024 15:56:08 +0200 Subject: [PATCH] SONAR-23030 Add deprecation notices --- .../design-system/src/components/Text.tsx | 31 +++++++++++++++---- .../components/typography/Title.tsx | 11 +++++++ 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/server/sonar-web/design-system/src/components/Text.tsx b/server/sonar-web/design-system/src/components/Text.tsx index da407eed159..7b80879f1fa 100644 --- a/server/sonar-web/design-system/src/components/Text.tsx +++ b/server/sonar-web/design-system/src/components/Text.tsx @@ -28,6 +28,8 @@ interface TextBoldProps { name: string; } +/** @deprecated Use Text (with `isHighlighted` prop) from Echoes instead. + */ export function TextBold({ match, name, className }: TextBoldProps) { return match ? ( @@ -51,6 +55,8 @@ export function TextMuted({ text, className }: { className?: string; text: strin ); } +/** @deprecated Use Heading from Echoes instead. + */ export function PageTitle({ text, className, @@ -67,6 +73,8 @@ export function PageTitle({ ); } +/** @deprecated Use Text (with `colorOverride='echoes-color-text-danger'` prop) from Echoes instead. + */ export function TextError({ as, text, @@ -90,6 +98,8 @@ export function TextError({ ); } +/** @deprecated Use Text (with `colorOverride='echoes-color-text-success'` prop) from Echoes instead. + */ export function TextSuccess({ text, className }: Readonly<{ className?: string; text: string }>) { return ( @@ -98,7 +108,7 @@ export function TextSuccess({ text, className }: Readonly<{ className?: string; ); } -export const StyledText = styled.span` +const StyledText = styled.span` ${tw`sw-inline-block`}; ${tw`sw-truncate`}; ${tw`sw-font-semibold`}; @@ -112,11 +122,15 @@ export const StyledText = styled.span` } `; +/** @deprecated Use Text (with `isSubdued` prop) from Echoes instead. + */ export const StyledMutedText = styled(StyledText)` ${tw`sw-font-regular`}; color: ${themeColor('dropdownMenuSubTitle')}; `; +/** @deprecated Use Heading from Echoes instead. + */ export const StyledPageTitle = styled(StyledText)` ${tw`sw-block`}; ${tw`sw-text-base`} @@ -131,30 +145,35 @@ const StyledTextSuccess = styled(StyledText)` color: ${themeColor('textSuccess')}; `; -export const TextDisabled = styled.span` - ${tw`sw-font-regular`}; - color: ${themeColor('textDisabled')}; -`; - +/** @deprecated Use Text (with `isSubdued` prop) from Echoes instead. + */ export const TextSubdued = styled.span` ${tw`sw-font-regular`}; color: ${themeColor('textSubdued')}; `; +/** @deprecated Use Text (with `isSubdued` prop) from Echoes instead. + */ export const LightLabel = styled.span` color: ${themeColor('pageContentLight')}; `; +/** @deprecated Use Label or Text (with `isHighlighted` prop) from Echoes instead. + */ export const DarkLabel = styled.label` color: ${themeColor('pageContentDark')}; ${tw`sw-body-sm-highlight`} `; +/** @deprecated Use Text from Echoes instead. + */ export const LightPrimary = styled.span` color: ${themeContrast('primaryLight')}; `; +/** @deprecated Use Text (with `isHighlighted` prop) from Echoes instead. + */ export const Highlight = styled.strong` color: ${themeColor('pageContentDark')}; diff --git a/server/sonar-web/design-system/src/sonar-aligned/components/typography/Title.tsx b/server/sonar-web/design-system/src/sonar-aligned/components/typography/Title.tsx index af59c37b4fc..1abade832f7 100644 --- a/server/sonar-web/design-system/src/sonar-aligned/components/typography/Title.tsx +++ b/server/sonar-web/design-system/src/sonar-aligned/components/typography/Title.tsx @@ -17,34 +17,45 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import styled from '@emotion/styled'; import tw from 'twin.macro'; import { themeColor } from '../../../helpers/theme'; +/** @deprecated Use Heading from Echoes instead. + */ export const Title = styled.h1` ${tw`sw-heading-lg`} ${tw`sw-mb-4`} color: ${themeColor('pageTitle')}; `; +/** @deprecated Use Heading from Echoes instead. + */ export const SubTitle = styled.h2` ${tw`sw-heading-md`} ${tw`sw-mb-4`} color: ${themeColor('pageTitle')}; `; +/** @deprecated Use Heading from Echoes instead. + */ export const HeadingDark = styled.h2` color: ${themeColor('pageContentDark')}; ${tw`sw-body-sm-highlight`} `; +/** @deprecated Use Heading from Echoes instead. + */ export const SubHeading = styled.h3` ${tw`sw-body-md-highlight`} ${tw`sw-mb-2`} color: ${themeColor('pageContent')}; `; +/** @deprecated Use Heading from Echoes instead. + */ export const SubHeadingHighlight = styled(SubHeading)` color: ${themeColor('pageContentDark')}; `; -- 2.39.5