mirror of
https://github.com/SomboChea/ui
synced 2026-01-18 00:56:00 +07:00
initial commit
This commit is contained in:
18
src/components/Spinner/index.js
Normal file
18
src/components/Spinner/index.js
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @prettier
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import type { Node } from 'react';
|
||||
|
||||
import { IProps } from './types';
|
||||
import { Wrapper, Circular } from './styles';
|
||||
|
||||
const Spinner = ({ size = 50, centered = false }: IProps): Node => (
|
||||
<Wrapper centered={centered}>
|
||||
<Circular size={size} />
|
||||
</Wrapper>
|
||||
);
|
||||
|
||||
export default Spinner;
|
||||
30
src/components/Spinner/styles.js
Normal file
30
src/components/Spinner/styles.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @prettier
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import styled, { css } from 'react-emotion';
|
||||
import CircularProgress from '@material-ui/core/CircularProgress/index';
|
||||
import colors from '../../utils/styles/colors';
|
||||
|
||||
export const Wrapper = styled.div`
|
||||
&& {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
${props =>
|
||||
props.centered &&
|
||||
css`
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
`};
|
||||
}
|
||||
`;
|
||||
|
||||
export const Circular = styled(CircularProgress)`
|
||||
&& {
|
||||
color: ${colors.primary};
|
||||
}
|
||||
`;
|
||||
9
src/components/Spinner/types.js
Normal file
9
src/components/Spinner/types.js
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* @prettier
|
||||
* @flow
|
||||
*/
|
||||
|
||||
export interface IProps {
|
||||
size?: number;
|
||||
centered?: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user