Skip to content

Commit

Permalink
fix(client): tick icon on ios devices
Browse files Browse the repository at this point in the history
  • Loading branch information
Jozwiaczek committed Aug 12, 2021
1 parent a45a3e1 commit 6e5060a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Meta, Story } from '@storybook/react/types-6-0';
import React, { useState } from 'react';

import Checkmark from '.';
import { CheckmarkProps } from './Checkmark.types';

export default {
title: 'Elements/animations/Checkmark',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import { SVGProps } from 'react';

interface CheckmarkProps {
visible: boolean;
}

interface TickIconProps extends SVGProps<SVGSVGElement> {
isVisible?: boolean;
}
4 changes: 3 additions & 1 deletion packages/client/src/elements/animations/Checkmark/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import anime, { AnimeInstance } from 'animejs';
import React, { useLayoutEffect, useRef } from 'react';
import { TickIcon } from 'src/icons';

import { CheckmarkProps } from './Checkmark.types';

const Checkmark = ({ visible = false }: CheckmarkProps) => {
const tick = useRef<SVGPathElement>(null);
const animationRefShow = useRef<AnimeInstance>();
Expand Down Expand Up @@ -38,7 +40,7 @@ const Checkmark = ({ visible = false }: CheckmarkProps) => {
animationRefHide.current?.play();
}, [visible]);

return <TickIcon ref={tick} />;
return <TickIcon isVisible={visible} ref={tick} />;
};

Checkmark.displayName = 'Checkmark';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
component: ThemeTypeIndicator,
} as Meta;

const Template: Story<CheckmarkProps> = () => {
const Template: Story = () => {
const [themeType, setThemeType] = useState<ThemeType>(ThemeType.dark);

const showDark = () => {
Expand Down
13 changes: 8 additions & 5 deletions packages/client/src/icons/TickIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import React, { forwardRef, memo, Ref, SVGProps } from 'react';
import React, { forwardRef, memo, Ref } from 'react';

const TickIcon = (props: SVGProps<SVGSVGElement>, svgRef?: Ref<SVGPathElement>) => (
import { TickIconProps } from '../elements/animations/Checkmark/Checkmark.types';

const TickIcon = ({ isVisible = true, ...rest }: TickIconProps, svgRef?: Ref<SVGPathElement>) => (
<svg
width="100%"
height="100%"
viewBox="0 0 8 7"
fill="none"
xmlns="http://www.w3.org/2000/svg"
{...props}
{...rest}
>
<path
ref={svgRef}
d="M1 3l2.143 2.5L7 1"
stroke="currentColor"
strokeWidth={2}
strokeDashoffset={0}
strokeMiterlimit={10}
strokeLinecap="round"
strokeLinejoin="round"
strokeLinecap={isVisible ? 'round' : undefined}
strokeLinejoin={isVisible ? 'round' : undefined}
/>
</svg>
);
Expand Down

0 comments on commit 6e5060a

Please sign in to comment.