Skip to content

Commit

Permalink
feat: change the close icon for modal and remove Close text
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinCupela committed Jul 5, 2022
1 parent ecd0b4b commit 88a5f7c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { PropsWithChildren, useEffect, useRef } from 'react';

import { useTranslationContext } from '../../context/TranslationContext';
import { CloseIcon } from './icons';

export type ModalProps = {
/** If true, modal is opened or visible. */
Expand All @@ -12,8 +12,6 @@ export type ModalProps = {
export const Modal = (props: PropsWithChildren<ModalProps>) => {
const { children, onClose, open } = props;

const { t } = useTranslationContext('Modal');

const innerRef = useRef<HTMLDivElement | null>(null);
const closeRef = useRef<HTMLButtonElement | null>(null);

Expand Down Expand Up @@ -42,13 +40,7 @@ export const Modal = (props: PropsWithChildren<ModalProps>) => {
return (
<div className={`str-chat__modal ${openClasses}`} onClick={handleClick}>
<button className='str-chat__modal__close-button' ref={closeRef} title='Close'>
{t<string>('Close')}
<svg height='10' width='10' xmlns='http://www.w3.org/2000/svg'>
<path
d='M9.916 1.027L8.973.084 5 4.058 1.027.084l-.943.943L4.058 5 .084 8.973l.943.943L5 5.942l3.973 3.974.943-.943L5.942 5z'
fillRule='evenodd'
/>
</svg>
<CloseIcon />
</button>
<div className='str-chat__modal__inner' ref={innerRef}>
{children}
Expand Down
21 changes: 21 additions & 0 deletions src/components/Modal/icons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';

export const CloseIcon = () => (
<svg
data-testid='close-icon'
fill='none'
height='28'
viewBox='0 0 28 28'
width='28'
xmlns='http://www.w3.org/2000/svg'
>
<rect fill='#72767E' height='28' rx='14' width='28' />
<circle cx='14' cy='14' fill='#72767E' r='12' />
<path
clipRule='evenodd'
d='M28 14C28 21.732 21.732 28 14 28C6.26801 28 0 21.732 0 14C0 6.26801 6.26801 0 14 0C21.732 0 28 6.26801 28 14ZM26 14C26 20.6274 20.6274 26 14 26C7.37258 26 2 20.6274 2 14C2 7.37258 7.37258 2 14 2C20.6274 2 26 7.37258 26 14ZM19.59 7L21 8.41L15.41 14L21 19.59L19.59 21L14 15.41L8.41 21L7 19.59L12.59 14L7 8.41L8.41 7L14 12.59L19.59 7Z'
fill='white'
fillRule='evenodd'
/>
</svg>
);

0 comments on commit 88a5f7c

Please sign in to comment.