React 18 and Vite (#4510)
This commit is contained in:
parent
1bb1b13f6d
commit
21613fa602
244 changed files with 4547 additions and 8933 deletions
|
@ -1,19 +1,23 @@
|
|||
import React, { Suspense } from 'react';
|
||||
import styled, { css, keyframes } from 'styled-components/macro';
|
||||
import type { FC, ReactNode } from 'react';
|
||||
import { Suspense } from 'react';
|
||||
import styled, { css, keyframes } from 'styled-components';
|
||||
import tw from 'twin.macro';
|
||||
|
||||
import ErrorBoundary from '@/components/elements/ErrorBoundary';
|
||||
|
||||
export type SpinnerSize = 'small' | 'base' | 'large';
|
||||
|
||||
interface Props {
|
||||
children?: ReactNode;
|
||||
|
||||
size?: SpinnerSize;
|
||||
centered?: boolean;
|
||||
isBlue?: boolean;
|
||||
}
|
||||
|
||||
interface Spinner extends React.FC<Props> {
|
||||
interface Spinner extends FC<Props> {
|
||||
Size: Record<'SMALL' | 'BASE' | 'LARGE', SpinnerSize>;
|
||||
Suspense: React.FC<Props>;
|
||||
Suspense: FC<Props>;
|
||||
}
|
||||
|
||||
const spin = keyframes`
|
||||
|
@ -27,7 +31,7 @@ const SpinnerComponent = styled.div<Props>`
|
|||
border-radius: 50%;
|
||||
animation: ${spin} 1s cubic-bezier(0.55, 0.25, 0.25, 0.7) infinite;
|
||||
|
||||
${(props) =>
|
||||
${props =>
|
||||
props.size === 'small'
|
||||
? tw`w-4 h-4 border-2`
|
||||
: props.size === 'large'
|
||||
|
@ -37,8 +41,8 @@ const SpinnerComponent = styled.div<Props>`
|
|||
`
|
||||
: null};
|
||||
|
||||
border-color: ${(props) => (!props.isBlue ? 'rgba(255, 255, 255, 0.2)' : 'hsla(212, 92%, 43%, 0.2)')};
|
||||
border-top-color: ${(props) => (!props.isBlue ? 'rgb(255, 255, 255)' : 'hsl(212, 92%, 43%)')};
|
||||
border-color: ${props => (!props.isBlue ? 'rgba(255, 255, 255, 0.2)' : 'hsla(212, 92%, 43%, 0.2)')};
|
||||
border-top-color: ${props => (!props.isBlue ? 'rgb(255, 255, 255)' : 'hsl(212, 92%, 43%)')};
|
||||
`;
|
||||
|
||||
const Spinner: Spinner = ({ centered, ...props }) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue