Skip to content

Commit 4c47412

Browse files
authored
fix(Icon): rename from IconContainer (#554)
1 parent 447d936 commit 4c47412

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

.changeset/gold-buckets-jump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cube-dev/ui-kit': minor
3+
---
4+
5+
Rename IconContainer -> Icon.

src/icons/IconContainer.tsx renamed to src/icons/Icon.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
tasty,
1313
} from '../tasty';
1414

15-
const IconContainerElement = tasty({
15+
const IconElement = tasty({
1616
as: 'span',
1717
styles: {
1818
display: 'inline-grid',
@@ -21,6 +21,10 @@ const IconContainerElement = tasty({
2121
width: '1em 1em',
2222
height: 'min 1em',
2323
fontSize: 'var(--icon-size, var(--font-size))',
24+
textAlign: 'center',
25+
textTransform: 'none',
26+
textRendering: 'optimizeLegibility',
27+
'-webkit-font-smoothing': 'antialiased',
2428

2529
'& svg': {
2630
width: '1em 1em',
@@ -38,11 +42,11 @@ export interface CubeIconProps
3842
size?: Styles['fontSize'];
3943
}
4044

41-
export const IconContainer = memo(function IconContainer(props: CubeIconProps) {
45+
export const Icon = memo(function Icon(props: CubeIconProps) {
4246
const { size, ...rest } = props;
4347

4448
return (
45-
<IconContainerElement
49+
<IconElement
4650
qa="Icon"
4751
{...rest}
4852
styles={

src/icons/Icons.stories.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import { Space } from '../components/layout/Space';
66
import { Title } from '../components/content/Title';
77
import { Flow } from '../components/layout/Flow';
88

9-
import { CubeIconProps, IconContainer } from './IconContainer';
9+
import { CubeIconProps, Icon } from './Icon';
1010

1111
import * as Icons from './index';
1212

1313
export default {
1414
title: 'Content/Icons',
15-
component: IconContainer,
15+
component: Icon,
1616
parameters: {
1717
controls: {
1818
exclude: baseProps,
@@ -26,8 +26,7 @@ const Template: StoryFn<CubeIconProps> = (name) => {
2626
<Title>16px</Title>
2727
<Grid columns="repeat(auto-fit, 200px)" flow="row" gap="16px">
2828
{Object.keys(Icons).map((iconName) => {
29-
if (iconName === 'IconContainer' || iconName === 'wrapIcon')
30-
return null;
29+
if (iconName === 'Icon' || iconName === 'wrapIcon') return null;
3130

3231
const Icon = Icons[iconName];
3332

@@ -42,8 +41,7 @@ const Template: StoryFn<CubeIconProps> = (name) => {
4241
<Title>32px</Title>
4342
<Grid columns="repeat(auto-fit, 200px)" flow="row" gap="16px">
4443
{Object.keys(Icons).map((iconName) => {
45-
if (iconName === 'IconContainer' || iconName === 'wrapIcon')
46-
return null;
44+
if (iconName === 'Icon' || iconName === 'wrapIcon') return null;
4745

4846
const Icon = Icons[iconName];
4947

src/icons/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ export { WarningFilledIcon } from './WarningFilledIcon';
7979
export { WarningIcon } from './WarningIcon';
8080
export { wrapIcon } from './wrap-icon';
8181

82-
export { IconContainer } from './IconContainer';
83-
export type { CubeIconProps } from './IconContainer';
82+
export { Icon } from './Icon';
83+
export type { CubeIconProps } from './Icon';

src/icons/wrap-icon.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { ReactNode } from 'react';
22

3-
import { CubeIconProps, IconContainer } from './IconContainer';
3+
import { CubeIconProps, Icon } from './Icon';
44

55
export function wrapIcon(name: string, icon: ReactNode) {
6-
function Icon(props: CubeIconProps) {
6+
function IconWrapper(props: CubeIconProps) {
77
return (
8-
<IconContainer qa={name} aria-hidden="true" {...props}>
8+
<Icon qa={name} aria-hidden="true" {...props}>
99
{icon}
10-
</IconContainer>
10+
</Icon>
1111
);
1212
}
1313

14-
Icon.displayName = name;
14+
IconWrapper.displayName = name;
1515

16-
return Icon;
16+
return IconWrapper;
1717
}

0 commit comments

Comments
 (0)