misc_pterodactyl-panel/resources/scripts/components/elements/InputSpinner.tsx

32 lines
919 B
TypeScript
Raw Permalink Normal View History

import React from 'react';
import Spinner from '@/components/elements/Spinner';
2020-07-04 22:19:46 +00:00
import Fade from '@/components/elements/Fade';
import tw from 'twin.macro';
import styled, { css } from 'styled-components/macro';
import Select from '@/components/elements/Select';
const Container = styled.div<{ visible?: boolean }>`
${tw`relative`};
${(props) =>
props.visible &&
css`
& ${Select} {
background-image: none;
}
`};
`;
const InputSpinner = ({ visible, children }: { visible: boolean; children: React.ReactNode }) => (
<Container visible={visible}>
<Fade appear unmountOnExit in={visible} timeout={150}>
2020-07-04 22:19:46 +00:00
<div css={tw`absolute right-0 h-full flex items-center justify-end pr-3`}>
<Spinner size={'small'} />
</div>
2020-07-04 22:19:46 +00:00
</Fade>
{children}
</Container>
);
export default InputSpinner;