Skip to content

Commit

Permalink
feat: rotate doing icon in status (#35)
Browse files Browse the repository at this point in the history
* feat: rotate doing icon in status

* add rotation to the waiting icon in status
  • Loading branch information
romainlq committed Jun 15, 2021
1 parent 3b8364e commit 4272d55
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/components/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React from 'react';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { css, jsx } from '@emotion/react';
import { css, jsx, keyframes } from '@emotion/react';
import styled from '@emotion/styled';

import { Colors, Fonts, Spaces } from '@/assets/theme';
Expand All @@ -27,6 +27,19 @@ const StatusIcon = styled.div`
margin-right: ${Spaces.small};
`;

const rotate = keyframes`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`;

const rotation = css`
animation: ${rotate} 2s linear infinite;
`;

const Status = ({ status }: StatusProps): JSX.Element => {
let type = '';
let icon: JSX.Element | null = null;
Expand All @@ -38,11 +51,11 @@ const Status = ({ status }: StatusProps): JSX.Element => {
break;
case TaskStatus.waiting:
case TaskStatus.todo:
icon = <RiLoader4Line color={Colors.running} />;
icon = <RiLoader4Line css={rotation} color={Colors.running} />;
type = Colors.running;
break;
case TaskStatus.doing:
icon = <RiLoader4Line color={Colors.success} />;
icon = <RiLoader4Line css={rotation} color={Colors.success} />;
type = Colors.success;
break;
case TaskStatus.failed:
Expand Down

0 comments on commit 4272d55

Please sign in to comment.