Skip to content

Commit ec53455

Browse files
committed
feat: adds StyledBaseIcon to notifications
1 parent fc5ef83 commit ec53455

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

packages/notifications/src/elements/Alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const AlertComponent = React.forwardRef<HTMLDivElement, IAlertProps>(
2323
return (
2424
<NotificationsContext.Provider value={hue as Hue}>
2525
<StyledAlert ref={ref} hue={hue} role={role === undefined ? 'alert' : role} {...props}>
26-
<StyledIcon hue={hue}>
26+
<StyledIcon $hue={hue}>
2727
<Icon />
2828
</StyledIcon>
2929
{props.children}

packages/notifications/src/elements/Notification.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const NotificationComponent = forwardRef<HTMLDivElement, INotificationPro
2929
role={role === undefined ? 'status' : role}
3030
>
3131
{props.type && (
32-
<StyledIcon hue={hue}>
32+
<StyledIcon $hue={hue}>
3333
<Icon />
3434
</StyledIcon>
3535
)}

packages/notifications/src/styled/StyledIcon.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@
55
* found at http://www.apache.org/licenses/LICENSE-2.0.
66
*/
77

8-
import React, { Children } from 'react';
98
import styled from 'styled-components';
10-
import { getColorV8, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9+
import { getColorV8, DEFAULT_THEME, StyledBaseIcon } from '@zendeskgarden/react-theming';
1110

12-
export const StyledIcon = styled(({ children, ...props }) =>
13-
React.cloneElement(Children.only(children), props)
14-
)`
11+
export const StyledIcon = styled(StyledBaseIcon)`
1512
position: absolute;
1613
right: ${props => props.theme.rtl && `${props.theme.space.base * 4}px`};
1714
left: ${props => !props.theme.rtl && `${props.theme.space.base * 4}px`};
1815
margin-top: ${props => props.theme.space.base / 2}px;
1916
color: ${props =>
20-
props.hue && getColorV8(props.hue, props.hue === 'warningHue' ? 700 : 600, props.theme)};
17+
props.$hue && getColorV8(props.$hue, props.$hue === 'warningHue' ? 700 : 600, props.theme)};
2118
`;
2219

2320
StyledIcon.defaultProps = {

0 commit comments

Comments
 (0)