Skip to content

Commit

Permalink
Merge pull request #1141 from ZopaPublic/errorMsgIcon2
Browse files Browse the repository at this point in the history
Error msg icon2
  • Loading branch information
gbkr authored Aug 19, 2024
2 parents b24fbe0 + 5760966 commit dcecad7
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/long-beds-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@zopauk/react-components': patch
---

New icon for ErrorMessage
8 changes: 2 additions & 6 deletions src/components/atoms/ErrorMessage/ErrorMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import { typography } from '../../../constants/typography';
import Text from '../Text/Text';
import Icon from '../Icon/Icon';
import { useThemeContext } from '../../styles/Theme';
import TriangleExclamationIcon from '../../styles/icons/triangleExclamation';
import CircleExclamationIcon from '../../styles/icons/circleExclamation';
import InfoCircleIcon from '../../styles/icons/infoCircle';
import CircleExclamation2Icon from '../../styles/icons/circleExclamation2';

const StyledErrorMessage = styled(Text).attrs({
role: 'alert',
Expand Down Expand Up @@ -52,9 +50,7 @@ const ErrorMessage = ({ children, className, id, ...rest }: ErrorMessageProps) =

if (theme.errorMessage.iconVariant) {
const iconMap = {
'circle-exclamation': CircleExclamationIcon,
'triangle-exclamation': TriangleExclamationIcon,
'info-circle': InfoCircleIcon,
'circle-exclamation2': CircleExclamation2Icon,
};

const iconVariant = theme.errorMessage.iconVariant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Object {
class="py-6"
>
<h5
class="sc-gipzik jmoHBR mb-2"
class="sc-iRbamj gTdRfb mb-2"
>
Form Section
</h5>
Expand Down
6 changes: 3 additions & 3 deletions src/components/styles/Theme/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Severity } from '../../atoms/Alert/Alert';
import { spacing } from '../../../constants';
import { ProductTemplateV2 } from '../../templates/ProductTemplate/ProductTemplate/ProductTemplateV2';

export type CustomIconVariant = 'circle-exclamation' | 'info-circle' | 'triangle-exclamation';
export type CustomIconVariant = 'circle-exclamation' | 'circle-exclamation2' | 'info-circle' | 'triangle-exclamation';

export interface ButtonTheme {
text: string;
Expand Down Expand Up @@ -66,7 +66,7 @@ export type AlertTheme = Record<
text: string;
component?: () => ReactElement;
faVariant?: { prefix: IconPrefix; iconName: IconName };
customVariant?: { iconName: CustomIconVariant; color: string };
customVariant?: { iconName: Exclude<CustomIconVariant, 'circle-exclamation2'>; color: string };
}
>;

Expand All @@ -86,7 +86,7 @@ export interface ErrorMessageTheme {
backgroundColor: string;
padding: string;
icon: boolean;
iconVariant?: { name: CustomIconVariant; color: string };
iconVariant?: { name: Extract<CustomIconVariant, 'circle-exclamation2'>; color: string };
}

export interface FooterTheme {
Expand Down
24 changes: 24 additions & 0 deletions src/components/styles/icons/circleExclamation2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from 'react';
import styled from 'styled-components';

const CircleExclamationIconWrapper = styled.div`
width: 22.5px;
height: 22.5px;
`;

const CircleExclamation2Icon = ({ color }: { color: string }) => (
<CircleExclamationIconWrapper>
<svg xmlns="http://www.w3.org/2000/svg" width={16} height={16} fill="none">
<g fill={color} clipPath="url(#a)">
<path d="M8 1.28c3.72 0 6.72 3.04 6.72 6.72 0 3.68-3 6.72-6.72 6.72-3.72 0-6.72-3-6.72-6.72 0-3.72 3-6.72 6.72-6.72ZM8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8Z" />
<path d="M8.8 3.92H7.12V9.4H8.8V3.92ZM7.96 10.36a.82.82 0 0 0-.84.84c0 .48.36.84.84.84s.84-.36.84-.84a.82.82 0 0 0-.84-.84Z" />
</g>
<defs>
<clipPath id="a">
<path fill="#fff" d="M0 0h16v16H0z" />
</clipPath>
</defs>
</svg>
</CircleExclamationIconWrapper>
);
export default CircleExclamation2Icon;

0 comments on commit dcecad7

Please sign in to comment.