diff options
author | David Cho-Lerat <david.cho-lerat@sonarsource.com> | 2024-04-10 18:09:09 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-04-12 12:49:16 +0000 |
commit | 9f8265e3add28e5c35b24c7bc2b0acbef2bc8f8f (patch) | |
tree | a5238f3b8cb56051771c6512e853bd93a250df2c /server | |
parent | 8ee3c3907267332347808cd0b5740ad82c9428d6 (diff) | |
download | sonarqube-9f8265e3add28e5c35b24c7bc2b0acbef2bc8f8f.tar.gz sonarqube-9f8265e3add28e5c35b24c7bc2b0acbef2bc8f8f.zip |
SONAR-21973 Add deprecation notices for IconProps, CustomIcon, OcticonHoc
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-web/design-system/src/components/icons/Icon.tsx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/server/sonar-web/design-system/src/components/icons/Icon.tsx b/server/sonar-web/design-system/src/components/icons/Icon.tsx index d4c68fd7a64..dd86a89e647 100644 --- a/server/sonar-web/design-system/src/components/icons/Icon.tsx +++ b/server/sonar-web/design-system/src/components/icons/Icon.tsx @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import { useTheme } from '@emotion/react'; import { OcticonProps } from '@primer/octicons-react'; import React from 'react'; @@ -32,6 +33,21 @@ interface Props { description?: React.ReactNode; } +/** @deprecated Use IconProps from Echoes instead. + * + * Some of the props have been dropped: + * - ~`aria-hidden`~ is now inferred from the absence of an `aria-label` + * - ~`data-guiding-id`~ is no longer passed down to the DOM, put it on a wrapper instead + * - ~`description`~ doesn't exist anymore + * - ~`fill`~ doesn't exist anymore, icon colors cannot be overrriden anymore, they take the color + * of their surroundings (currentColor) or have an intrinsic color. If you need to change the + * color, either make sure the wrapper has a color, or define a styled(MyIcon). Those cases should + * be rare and happen only during the transition to Echoes icons. + * - ~`height`~ doesn't exist anymore, icons are sized based on the font-size of their parent + * - ~`transform`~ doesn't exist anymore + * - ~`viewbox`~ doesn't exist anymore, icons are sized based on the font-size of their parent + * - ~`width`~ doesn't exist anymore, icons are sized based on the font-size of their parent + */ export interface IconProps extends Omit<Props, 'children'> { ['data-guiding-id']?: string; fill?: ThemeColors | CSSColor; @@ -47,6 +63,7 @@ function convertRemToPixel(remString: string) { return Number(remString.replace('rem', '')) * PIXELS_IN_ONE_REM; } +/** @deprecated Don't create new icons based on this, use the ones from Echoes instead. */ export function CustomIcon(props: Props) { const { 'aria-label': ariaLabel, @@ -86,6 +103,7 @@ export function CustomIcon(props: Props) { ); } +/** @deprecated Don't create new icons based on this, use the ones from Echoes instead. */ export function OcticonHoc( WrappedOcticon: React.ComponentType<React.PropsWithChildren<OcticonProps>>, displayName?: string, |