From adcd2682ef64747035ef3feacc1c40d5c533bd6e Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 22 Jun 2019 18:53:50 -0700 Subject: [PATCH] Start working on some defined styles, begin implementing password update in account --- resources/assets/styles/components/forms.css | 97 +++++++++++++------ .../components/account/AccountOverview.tsx | 7 -- .../account/AccountOverviewContainer.tsx | 19 ++++ .../components/account/DesignElements.tsx | 53 ---------- .../account/DesignElementsContainer.tsx | 69 +++++++++++++ .../account/forms/UpdatePasswordForm.tsx | 47 +++++++++ .../components/elements/ContentBox.tsx | 18 ++++ resources/scripts/routers/AccountRouter.tsx | 7 +- 8 files changed, 226 insertions(+), 91 deletions(-) delete mode 100644 resources/scripts/components/account/AccountOverview.tsx create mode 100644 resources/scripts/components/account/AccountOverviewContainer.tsx delete mode 100644 resources/scripts/components/account/DesignElements.tsx create mode 100644 resources/scripts/components/account/DesignElementsContainer.tsx create mode 100644 resources/scripts/components/account/forms/UpdatePasswordForm.tsx create mode 100644 resources/scripts/components/elements/ContentBox.tsx diff --git a/resources/assets/styles/components/forms.css b/resources/assets/styles/components/forms.css index 93fca8d36..d734fca9d 100644 --- a/resources/assets/styles/components/forms.css +++ b/resources/assets/styles/components/forms.css @@ -15,19 +15,23 @@ input[type=number] { /** * Styling for other forms throughout the Panel. */ -.input { - @apply .appearance-none .p-3 .rounded .border .border-neutral-200 .text-neutral-800 .w-full; +.input, .input-dark { + @apply .appearance-none .w-full; min-width: 0; + + &:required, &:invalid { + box-shadow: none; + } +} + +.input { + @apply .p-3 .rounded .border .border-neutral-200 .text-neutral-800; transition: border 150ms linear; &:focus { @apply .border-primary-400; } - &:required, &:invalid { - box-shadow: none; - } - &.error { @apply .text-red-600 .border-red-500; } @@ -37,6 +41,39 @@ input[type=number] { @apply .bg-neutral-100 .border-neutral-200; } +.input + .input-help { + @apply .text-xs .text-neutral-400 .pt-2; + + &.error { + @apply .text-red-600; + } +} + +.input-dark { + @apply .p-3 .bg-neutral-600 .border .border-neutral-500 .text-sm .rounded .text-neutral-200; + transition: border 150ms linear, box-shaodw 150ms ease-in; + + &:focus { + @apply .shadow; + } + + & + .input-help { + @apply .text-xs .text-neutral-400 .mt-2 + } + + &.error { + @apply .text-red-100 .border-red-400; + } + + &.error + .input-help { + @apply .text-red-400; + } + + &:disabled { + @apply .opacity-75; + } +} + label { @apply .block .text-xs .font-medium .uppercase .text-neutral-700 .mb-2; } @@ -61,6 +98,10 @@ select:not(.appearance-none) { background-position-x: calc(100% - 0.75rem); } +.input-dark-label { + @apply .uppercase .text-neutral-200; +} + .input-label { @apply .block .uppercase .tracking-wide .text-neutral-800 .text-xs .font-bold; @@ -69,60 +110,60 @@ select:not(.appearance-none) { } } -.input-help { - @apply .text-xs .text-neutral-400 .pt-2; - - &.error { - @apply .text-red-600; - } -} - a.btn { @apply .no-underline; } .btn { - @apply .rounded .p-2; + @apply .rounded .p-2 .uppercase .tracking-wide .text-sm; transition: all 150ms linear; /** * Button Colors */ &.btn-primary { - @apply .bg-primary-500 .border-primary-600 .border .text-white; + @apply .bg-primary-500 .border-primary-600 .border .text-primary-50; &:hover:not(:disabled) { - @apply .bg-primary-600 .border-primary-800; + @apply .bg-primary-600 .border-primary-700; } } &.btn-green { - @apply .bg-green-500 .border-green-600 .border .text-white; + @apply .bg-green-500 .border-green-600 .border .text-green-50; &:hover:not(:disabled) { - @apply .bg-green-600 .border-green-800; + @apply .bg-green-600 .border-green-700; } } &.btn-red { &:not(.btn-secondary) { - @apply .bg-red-500 .border-red-600 .border .text-white; + @apply .bg-red-500 .border-red-600 .text-red-50; } &:hover:not(:disabled) { - @apply .bg-red-600 .border-red-800; + @apply .bg-red-600 .border-red-700; + } + } + + &.btn-grey { + @apply .border .border-neutral-600 .bg-neutral-500 .text-neutral-50; + + &:hover:not(:disabled) { + @apply .bg-neutral-600 .border-neutral-700; } } &.btn-secondary { - @apply .border .border-neutral-200 .text-neutral-400; + @apply .border .border-neutral-600 .bg-transparent .text-neutral-200; &:hover:not(:disabled) { - @apply .border-neutral-500 .text-neutral-700; + @apply .border-neutral-500 .text-neutral-100; } &.btn-red:hover:not(:disabled) { - @apply .bg-red-600 .border-red-800 .text-white; + @apply .bg-red-500 .border-red-600 .text-red-50; } } @@ -130,19 +171,19 @@ a.btn { * Button Sizes */ &.btn-jumbo { - @apply .p-4 .w-full .uppercase .tracking-wide .text-sm; + @apply .p-4 .w-full; } &.btn-lg { - @apply .p-4 .uppercase .tracking-wide .text-sm; + @apply .p-4 .text-sm; } &.btn-sm { - @apply .px-6 .py-3 .uppercase .tracking-wide .text-sm; + @apply .p-3; } &.btn-xs { - @apply .py-2 .px-2 .uppercase .text-xs; + @apply .p-2 .text-xs; } &:disabled, &.disabled { diff --git a/resources/scripts/components/account/AccountOverview.tsx b/resources/scripts/components/account/AccountOverview.tsx deleted file mode 100644 index 3bff15eed..000000000 --- a/resources/scripts/components/account/AccountOverview.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import * as React from 'react'; - -export default class AccountOverview extends React.PureComponent { - render () { - return null; - } -} diff --git a/resources/scripts/components/account/AccountOverviewContainer.tsx b/resources/scripts/components/account/AccountOverviewContainer.tsx new file mode 100644 index 000000000..158d30ed8 --- /dev/null +++ b/resources/scripts/components/account/AccountOverviewContainer.tsx @@ -0,0 +1,19 @@ +import * as React from 'react'; +import ContentBox from '@/components/elements/ContentBox'; +import UpdatePasswordForm from '@/components/account/forms/UpdatePasswordForm'; + +export default () => { + return ( +
+ + + +
+ + + + +
+
+ ); +}; diff --git a/resources/scripts/components/account/DesignElements.tsx b/resources/scripts/components/account/DesignElements.tsx deleted file mode 100644 index 319001987..000000000 --- a/resources/scripts/components/account/DesignElements.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import * as React from 'react'; -import { Link } from 'react-router-dom'; - -export default class DesignElements extends React.PureComponent { - render () { - return ( -
-
-
-

A Special Announcement

-
-

- Your demands have been received: Dark Mode will be default in Pterodactyl 0.8! -

-

Back

-
-
-
-

Form Elements

-
- - -

- This is some descriptive helper text to explain how things work. -

-
- - -
- - -
-
-
-
- ); - } -} diff --git a/resources/scripts/components/account/DesignElementsContainer.tsx b/resources/scripts/components/account/DesignElementsContainer.tsx new file mode 100644 index 000000000..ffa9c0ac7 --- /dev/null +++ b/resources/scripts/components/account/DesignElementsContainer.tsx @@ -0,0 +1,69 @@ +import * as React from 'react'; +import { Link } from 'react-router-dom'; +import ContentBox from '@/components/elements/ContentBox'; + +export default class DesignElementsContainer extends React.PureComponent { + render () { + return ( +
+
+ +

+ Your demands have been received: Dark Mode will be default in Pterodactyl 0.8! +

+

Back

+
+
+

Form Elements

+
+ + +

+ This is some descriptive helper text to explain how things work. +

+
+ + +

+ This field has an error. +

+
+ + +
+ + +
+ + + + +
+ + +
+ + +
+
+
+
+ ); + } +} diff --git a/resources/scripts/components/account/forms/UpdatePasswordForm.tsx b/resources/scripts/components/account/forms/UpdatePasswordForm.tsx new file mode 100644 index 000000000..1e1a720c7 --- /dev/null +++ b/resources/scripts/components/account/forms/UpdatePasswordForm.tsx @@ -0,0 +1,47 @@ +import React, { useState } from 'react'; +import { State, useStoreState } from 'easy-peasy'; +import { ApplicationState } from '@/state/types'; + +export default () => { + const [ isLoading, setIsLoading ] = useState(false); + const user = useStoreState((state: State) => state.user.data); + + if (!user) { + return null; + } + + return ( +
+ + +
+ + +

+ Your new password must be at least 8 characters in length. +

+
+
+ + +
+
+ +
+
+ ); +}; diff --git a/resources/scripts/components/elements/ContentBox.tsx b/resources/scripts/components/elements/ContentBox.tsx new file mode 100644 index 000000000..2862789b8 --- /dev/null +++ b/resources/scripts/components/elements/ContentBox.tsx @@ -0,0 +1,18 @@ +import * as React from 'react'; +import classNames from 'classnames'; + +type Props = Readonly, HTMLDivElement> & { + title?: string; + borderColor?: string; +}>; + +export default ({ title, borderColor, children, ...props }: Props) => ( +
+ {title &&

{title}

} +
+ {children} +
+
+); diff --git a/resources/scripts/routers/AccountRouter.tsx b/resources/scripts/routers/AccountRouter.tsx index 47f07c387..d6ecd04c3 100644 --- a/resources/scripts/routers/AccountRouter.tsx +++ b/resources/scripts/routers/AccountRouter.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; import { Route, RouteComponentProps } from 'react-router-dom'; -import DesignElements from '@/components/account/DesignElements'; +import DesignElementsContainer from '@/components/account/DesignElementsContainer'; +import AccountOverviewContainer from '@/components/account/AccountOverviewContainer'; export default ({ match }: RouteComponentProps) => (
- - + +
);