diff --git a/resources/scripts/components/FlashMessageRender.tsx b/resources/scripts/components/FlashMessageRender.tsx index 0af9d47e8..ed6671e80 100644 --- a/resources/scripts/components/FlashMessageRender.tsx +++ b/resources/scripts/components/FlashMessageRender.tsx @@ -2,13 +2,13 @@ import React from 'react'; import MessageBox from '@/components/MessageBox'; import { State, useStoreState } from 'easy-peasy'; import { ApplicationStore } from '@/state'; +import tw from 'twin.macro'; type Props = Readonly<{ byKey?: string; - spacerClass?: string; }>; -export default ({ spacerClass, byKey }: Props) => { +export default ({ byKey }: Props) => { const flashes = useStoreState((state: State) => state.flashes.items); let filtered = flashes; @@ -25,7 +25,7 @@ export default ({ spacerClass, byKey }: Props) => { { filtered.map((flash, index) => ( - {index > 0 &&
} + {index > 0 &&
} {flash.message} diff --git a/resources/scripts/components/auth/LoginCheckpointContainer.tsx b/resources/scripts/components/auth/LoginCheckpointContainer.tsx index dddcd0c1c..006ccc06b 100644 --- a/resources/scripts/components/auth/LoginCheckpointContainer.tsx +++ b/resources/scripts/components/auth/LoginCheckpointContainer.tsx @@ -54,7 +54,7 @@ const LoginCheckpointContainer = () => { disabled={isSubmitting} > {isSubmitting ? - + : 'Continue' } diff --git a/resources/scripts/components/auth/LoginContainer.tsx b/resources/scripts/components/auth/LoginContainer.tsx index bebc6a059..e3eda3fc2 100644 --- a/resources/scripts/components/auth/LoginContainer.tsx +++ b/resources/scripts/components/auth/LoginContainer.tsx @@ -61,7 +61,7 @@ const LoginContainer = ({ isSubmitting, setFieldValue, values, submitForm, handl className={'btn btn-primary btn-jumbo'} > {isSubmitting ? - + : 'Login' } diff --git a/resources/scripts/components/auth/ResetPasswordContainer.tsx b/resources/scripts/components/auth/ResetPasswordContainer.tsx index 7350e725a..67ee3dd24 100644 --- a/resources/scripts/components/auth/ResetPasswordContainer.tsx +++ b/resources/scripts/components/auth/ResetPasswordContainer.tsx @@ -92,7 +92,7 @@ export default ({ match, history, location }: Props) => { disabled={isSubmitting} > {isSubmitting ? - + : 'Reset Password' } diff --git a/resources/scripts/components/dashboard/ServerRow.tsx b/resources/scripts/components/dashboard/ServerRow.tsx index 89233728a..1cfe87d87 100644 --- a/resources/scripts/components/dashboard/ServerRow.tsx +++ b/resources/scripts/components/dashboard/ServerRow.tsx @@ -79,7 +79,7 @@ export default ({ server }: { server: Server }) => {
{!stats ? !statsError ? - + : server.isInstalling ?
diff --git a/resources/scripts/components/dashboard/forms/DisableTwoFactorModal.tsx b/resources/scripts/components/dashboard/forms/DisableTwoFactorModal.tsx index 6cadc595b..e0b52415a 100644 --- a/resources/scripts/components/dashboard/forms/DisableTwoFactorModal.tsx +++ b/resources/scripts/components/dashboard/forms/DisableTwoFactorModal.tsx @@ -8,6 +8,8 @@ import { Actions, useStoreActions } from 'easy-peasy'; import { ApplicationStore } from '@/state'; import disableAccountTwoFactor from '@/api/account/disableAccountTwoFactor'; import { httpErrorToHuman } from '@/api/http'; +import tw from 'twin.macro'; +import Button from '@/components/elements/Button'; interface Values { password: string; @@ -45,19 +47,19 @@ export default ({ ...props }: RequiredModalProps) => { {({ isSubmitting, isValid }) => (
- + -
- +
diff --git a/resources/scripts/components/elements/Button.tsx b/resources/scripts/components/elements/Button.tsx index 1450e2e91..6b70d315c 100644 --- a/resources/scripts/components/elements/Button.tsx +++ b/resources/scripts/components/elements/Button.tsx @@ -7,10 +7,9 @@ interface Props { size?: 'xsmall' | 'small' | 'large' | 'xlarge'; color?: 'green' | 'red' | 'primary' | 'grey'; isSecondary?: boolean; - disabled?: boolean; } -const StyledButton = styled.button` +const StyledButton = styled.button>` ${tw`rounded p-2 uppercase tracking-wide text-sm transition-all duration-150`}; ${props => props.isSecondary && css` @@ -73,9 +72,6 @@ const StyledButton = styled.button` ${props => props.size === 'xlarge' && tw`p-4 w-full`}; &:disabled { opacity: 0.55; cursor: default } - - ${props => props.disabled && css`opacity: 0.55; cursor: default`}; - `; type ComponentProps = Props & @@ -88,7 +84,7 @@ const Button: React.FC = ({ children, isLoading, ...props }) =>
} - + {children} diff --git a/resources/scripts/components/elements/Field.tsx b/resources/scripts/components/elements/Field.tsx index cb329d981..c6941cc4d 100644 --- a/resources/scripts/components/elements/Field.tsx +++ b/resources/scripts/components/elements/Field.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Field as FormikField, FieldProps } from 'formik'; -import classNames from 'classnames'; import Input from '@/components/elements/Input'; +import Label from '@/components/elements/Label'; interface OwnProps { name: string; @@ -19,7 +19,7 @@ const Field = ({ id, name, light = false, label, description, validate, classNam ({ field, form: { errors, touched } }: FieldProps) => ( {label && - + }
- +
{children} diff --git a/resources/scripts/components/elements/Label.tsx b/resources/scripts/components/elements/Label.tsx new file mode 100644 index 000000000..cfe16550b --- /dev/null +++ b/resources/scripts/components/elements/Label.tsx @@ -0,0 +1,9 @@ +import styled from 'styled-components/macro'; +import tw from 'twin.macro'; + +const Label = styled.label<{ isLight?: boolean }>` + ${tw`block text-xs uppercase text-neutral-200 mb-2`}; + ${props => props.isLight && tw`text-neutral-700`}; +`; + +export default Label; diff --git a/resources/scripts/components/elements/Spinner.tsx b/resources/scripts/components/elements/Spinner.tsx index cc4476abf..316062960 100644 --- a/resources/scripts/components/elements/Spinner.tsx +++ b/resources/scripts/components/elements/Spinner.tsx @@ -1,31 +1,48 @@ import React from 'react'; -import classNames from 'classnames'; +import styled, { css, keyframes } from 'styled-components/macro'; +import tw from 'twin.macro'; -export type SpinnerSize = 'large' | 'normal' | 'tiny'; +export type SpinnerSize = 'small' | 'base' | 'large'; interface Props { size?: SpinnerSize; centered?: boolean; - className?: string; + isBlue?: boolean; } -const Spinner = ({ size, centered, className }: Props) => ( +const spin = keyframes` + to { transform: rotate(360deg); } +`; + +// noinspection CssOverwrittenProperties +const SpinnerComponent = styled.div` + ${tw`w-8 h-8`}; + border-width: 3px; + border-radius: 50%; + animation: ${spin} 1s cubic-bezier(0.55, 0.25, 0.25, 0.70) infinite; + + ${props => props.size === 'small' ? tw`w-4 h-4 border-2` : (props.size === 'large' ? css` + ${tw`w-16 h-16`}; + border-width: 6px; + ` : 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%)'}; +`; + +const Spinner = ({ centered, ...props }: Props) => ( centered ? -
-
+
+
: -
+ ); +Spinner.DisplayName = 'Spinner'; export default Spinner; diff --git a/resources/scripts/components/elements/SpinnerOverlay.tsx b/resources/scripts/components/elements/SpinnerOverlay.tsx index 946afad87..58d17757e 100644 --- a/resources/scripts/components/elements/SpinnerOverlay.tsx +++ b/resources/scripts/components/elements/SpinnerOverlay.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import classNames from 'classnames'; -import { CSSTransition } from 'react-transition-group'; import Spinner, { SpinnerSize } from '@/components/elements/Spinner'; +import Fade from '@/components/elements/Fade'; +import tw from 'twin.macro'; interface Props { visible: boolean; @@ -11,17 +11,17 @@ interface Props { } const SpinnerOverlay = ({ size, fixed, visible, backgroundOpacity }: Props) => ( - +
-
+ ); export default SpinnerOverlay; diff --git a/resources/scripts/components/elements/SuspenseSpinner.tsx b/resources/scripts/components/elements/SuspenseSpinner.tsx index 3c2c42623..870ebc536 100644 --- a/resources/scripts/components/elements/SuspenseSpinner.tsx +++ b/resources/scripts/components/elements/SuspenseSpinner.tsx @@ -5,7 +5,7 @@ const SuspenseSpinner = ({ children }: { children?: React.ReactNode }) => ( - +
} > diff --git a/resources/scripts/components/server/WebsocketHandler.tsx b/resources/scripts/components/server/WebsocketHandler.tsx index 479304d37..dc7ffa3c3 100644 --- a/resources/scripts/components/server/WebsocketHandler.tsx +++ b/resources/scripts/components/server/WebsocketHandler.tsx @@ -69,7 +69,7 @@ export default () => {
- +

We're having some trouble connecting to your server, please wait...

diff --git a/resources/scripts/components/server/backups/BackupRow.tsx b/resources/scripts/components/server/backups/BackupRow.tsx index 5c2e1a61f..8a4f4f623 100644 --- a/resources/scripts/components/server/backups/BackupRow.tsx +++ b/resources/scripts/components/server/backups/BackupRow.tsx @@ -39,7 +39,7 @@ export default ({ backup, className }: Props) => { {backup.completedAt ? : - + }
diff --git a/resources/scripts/components/server/settings/RenameServerBox.tsx b/resources/scripts/components/server/settings/RenameServerBox.tsx index 83c0b2f6b..2904362e3 100644 --- a/resources/scripts/components/server/settings/RenameServerBox.tsx +++ b/resources/scripts/components/server/settings/RenameServerBox.tsx @@ -19,7 +19,7 @@ const RenameServerBox = () => { return ( - +