Skip to content

Commit 5473edc

Browse files
committed
Get spinners back in working order
1 parent d260200 commit 5473edc

File tree

16 files changed

+74
-50
lines changed

16 files changed

+74
-50
lines changed

resources/scripts/components/FlashMessageRender.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import React from 'react';
22
import MessageBox from '@/components/MessageBox';
33
import { State, useStoreState } from 'easy-peasy';
44
import { ApplicationStore } from '@/state';
5+
import tw from 'twin.macro';
56

67
type Props = Readonly<{
78
byKey?: string;
8-
spacerClass?: string;
99
}>;
1010

11-
export default ({ spacerClass, byKey }: Props) => {
11+
export default ({ byKey }: Props) => {
1212
const flashes = useStoreState((state: State<ApplicationStore>) => state.flashes.items);
1313

1414
let filtered = flashes;
@@ -25,7 +25,7 @@ export default ({ spacerClass, byKey }: Props) => {
2525
{
2626
filtered.map((flash, index) => (
2727
<React.Fragment key={flash.id || flash.type + flash.message}>
28-
{index > 0 && <div css={tw`${spacerClass || 'mt-2'}`}></div>}
28+
{index > 0 && <div css={tw`mt-2`}></div>}
2929
<MessageBox type={flash.type} title={flash.title}>
3030
{flash.message}
3131
</MessageBox>

resources/scripts/components/auth/LoginCheckpointContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const LoginCheckpointContainer = () => {
5454
disabled={isSubmitting}
5555
>
5656
{isSubmitting ?
57-
<Spinner size={'tiny'} className={'mx-auto'}/>
57+
<Spinner size={'small'} className={'mx-auto'}/>
5858
:
5959
'Continue'
6060
}

resources/scripts/components/auth/LoginContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const LoginContainer = ({ isSubmitting, setFieldValue, values, submitForm, handl
6161
className={'btn btn-primary btn-jumbo'}
6262
>
6363
{isSubmitting ?
64-
<Spinner size={'tiny'} className={'mx-auto'}/>
64+
<Spinner size={'small'} className={'mx-auto'}/>
6565
:
6666
'Login'
6767
}

resources/scripts/components/auth/ResetPasswordContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export default ({ match, history, location }: Props) => {
9292
disabled={isSubmitting}
9393
>
9494
{isSubmitting ?
95-
<Spinner size={'tiny'} className={'mx-auto'}/>
95+
<Spinner size={'small'} className={'mx-auto'}/>
9696
:
9797
'Reset Password'
9898
}

resources/scripts/components/dashboard/ServerRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default ({ server }: { server: Server }) => {
7979
<div css={tw`w-1/3 flex items-baseline relative`}>
8080
{!stats ?
8181
!statsError ?
82-
<SpinnerOverlay size={'tiny'} visible={true} backgroundOpacity={0.25}/>
82+
<SpinnerOverlay size={'small'} visible={true} backgroundOpacity={0.25}/>
8383
:
8484
server.isInstalling ?
8585
<div css={tw`flex-1 text-center`}>

resources/scripts/components/dashboard/forms/DisableTwoFactorModal.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { Actions, useStoreActions } from 'easy-peasy';
88
import { ApplicationStore } from '@/state';
99
import disableAccountTwoFactor from '@/api/account/disableAccountTwoFactor';
1010
import { httpErrorToHuman } from '@/api/http';
11+
import tw from 'twin.macro';
12+
import Button from '@/components/elements/Button';
1113

1214
interface Values {
1315
password: string;
@@ -45,19 +47,19 @@ export default ({ ...props }: RequiredModalProps) => {
4547
{({ isSubmitting, isValid }) => (
4648
<Modal {...props} dismissable={!isSubmitting} showSpinnerOverlay={isSubmitting}>
4749
<Form className={'mb-0'}>
48-
<FlashMessageRender className={'mb-6'} byKey={'account:two-factor'}/>
50+
<FlashMessageRender css={tw`mb-6`} byKey={'account:two-factor'}/>
4951
<Field
5052
id={'password'}
5153
name={'password'}
5254
type={'password'}
5355
label={'Current Password'}
5456
description={'In order to disable two-factor authentication you will need to provide your account password.'}
55-
autoFocus={true}
57+
autoFocus
5658
/>
57-
<div className={'mt-6 text-right'}>
58-
<button className={'btn btn-red btn-sm'} disabled={!isValid}>
59+
<div css={tw`mt-6 text-right`}>
60+
<Button disabled={!isValid}>
5961
Disable Two-Factor
60-
</button>
62+
</Button>
6163
</div>
6264
</Form>
6365
</Modal>

resources/scripts/components/elements/Button.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ interface Props {
77
size?: 'xsmall' | 'small' | 'large' | 'xlarge';
88
color?: 'green' | 'red' | 'primary' | 'grey';
99
isSecondary?: boolean;
10-
disabled?: boolean;
1110
}
1211

13-
const StyledButton = styled.button<Props>`
12+
const StyledButton = styled.button<Omit<Props, 'isLoading'>>`
1413
${tw`rounded p-2 uppercase tracking-wide text-sm transition-all duration-150`};
1514
1615
${props => props.isSecondary && css<Props>`
@@ -73,9 +72,6 @@ const StyledButton = styled.button<Props>`
7372
${props => props.size === 'xlarge' && tw`p-4 w-full`};
7473
7574
&:disabled { opacity: 0.55; cursor: default }
76-
77-
${props => props.disabled && css`opacity: 0.55; cursor: default`};
78-
7975
`;
8076

8177
type ComponentProps = Props &
@@ -88,7 +84,7 @@ const Button: React.FC<ComponentProps> = ({ children, isLoading, ...props }) =>
8884
<div className={'spinner-circle spinner-white spinner-sm'}/>
8985
</div>
9086
}
91-
<span css={isLoading && tw`text-transparent`}>
87+
<span css={isLoading ? tw`text-transparent` : undefined}>
9288
{children}
9389
</span>
9490
</StyledButton>

resources/scripts/components/elements/Field.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { Field as FormikField, FieldProps } from 'formik';
3-
import classNames from 'classnames';
43
import Input from '@/components/elements/Input';
4+
import Label from '@/components/elements/Label';
55

66
interface OwnProps {
77
name: string;
@@ -19,7 +19,7 @@ const Field = ({ id, name, light = false, label, description, validate, classNam
1919
({ field, form: { errors, touched } }: FieldProps) => (
2020
<React.Fragment>
2121
{label &&
22-
<label htmlFor={id} className={light ? undefined : 'input-dark-label'}>{label}</label>
22+
<Label htmlFor={id} isLight={light}>{label}</Label>
2323
}
2424
<Input
2525
id={id}

resources/scripts/components/elements/InputSpinner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const InputSpinner = ({ visible, children }: { visible: boolean, children: React
1212
classNames={'fade'}
1313
>
1414
<div className={'absolute right-0 h-full flex items-center justify-end pr-3'}>
15-
<Spinner size={'tiny'}/>
15+
<Spinner size={'small'}/>
1616
</div>
1717
</CSSTransition>
1818
{children}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import styled from 'styled-components/macro';
2+
import tw from 'twin.macro';
3+
4+
const Label = styled.label<{ isLight?: boolean }>`
5+
${tw`block text-xs uppercase text-neutral-200 mb-2`};
6+
${props => props.isLight && tw`text-neutral-700`};
7+
`;
8+
9+
export default Label;

0 commit comments

Comments
 (0)