From f4b25703db5fdaac66278629d987c5aa4214f22d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Holeczek?= Date: Sun, 1 Aug 2021 21:33:07 +0200 Subject: [PATCH] refactor: update views --- src/views/components/base/cards/Cards.js | 4 +- .../components/base/collapses/Collapses.js | 4 +- .../components/base/jumbotrons/Jumbotrons.js | 4 +- src/views/components/base/navbars/Navbars.js | 8 +- .../buttons/button-groups/ButtonGroups.js | 6 +- .../forms/checks-radios/ChecksRadios.js | 29 ++--- .../forms/floating-labels/FloatingLabels.js | 45 ++++--- .../forms/form-control/FormControl.js | 43 +++---- .../forms/input-group/InputGroup.js | 67 +++++----- src/views/components/forms/layout/Layout.js | 94 +++++++-------- src/views/components/forms/range/Range.js | 2 +- .../components/forms/validation/Validation.js | 114 +++++++++--------- src/views/components/icons/brands/Brands.js | 2 +- src/views/components/widgets/Widgets.js | 76 ++++++------ src/views/components/widgets/WidgetsBrand.js | 8 +- .../components/widgets/WidgetsDropdown.js | 8 +- src/views/dashboard/Dashboard.js | 16 +-- src/views/pages/login/Login.js | 12 +- src/views/pages/page404/Page404.js | 6 +- src/views/pages/page500/Page500.js | 6 +- src/views/pages/register/Register.js | 12 +- src/views/theme/colors/Colors.js | 2 +- 22 files changed, 275 insertions(+), 293 deletions(-) diff --git a/src/views/components/base/cards/Cards.js b/src/views/components/base/cards/Cards.js index 5ea9161..8836345 100644 --- a/src/views/components/base/cards/Cards.js +++ b/src/views/components/base/cards/Cards.js @@ -355,7 +355,7 @@ const Cards = () => {

- + Special title treatment @@ -366,7 +366,7 @@ const Cards = () => { - + Special title treatment diff --git a/src/views/components/base/collapses/Collapses.js b/src/views/components/base/collapses/Collapses.js index 4a85d39..1da1f42 100644 --- a/src/views/components/base/collapses/Collapses.js +++ b/src/views/components/base/collapses/Collapses.js @@ -64,7 +64,7 @@ const Collapses = () => { Toggle both elements - + @@ -75,7 +75,7 @@ const Collapses = () => { - + diff --git a/src/views/components/base/jumbotrons/Jumbotrons.js b/src/views/components/base/jumbotrons/Jumbotrons.js index 1bd9340..1129668 100644 --- a/src/views/components/base/jumbotrons/Jumbotrons.js +++ b/src/views/components/base/jumbotrons/Jumbotrons.js @@ -21,7 +21,7 @@ const Jumbotrons = () => { Example button - +

Change the background

@@ -33,7 +33,7 @@ const Jumbotrons = () => {

- +

Add borders

diff --git a/src/views/components/base/navbars/Navbars.js b/src/views/components/base/navbars/Navbars.js index e4c0e37..5bd3647 100644 --- a/src/views/components/base/navbars/Navbars.js +++ b/src/views/components/base/navbars/Navbars.js @@ -8,7 +8,7 @@ import { CDropdownMenu, CDropdownToggle, CForm, - CFormControl, + CFormInput, CImage, CNavbar, CNavbarNav, @@ -44,7 +44,7 @@ const CNavbars = () => { - + Search @@ -148,7 +148,7 @@ const CNavbars = () => { - + Search @@ -162,7 +162,7 @@ const CNavbars = () => { - + diff --git a/src/views/components/buttons/button-groups/ButtonGroups.js b/src/views/components/buttons/button-groups/ButtonGroups.js index 64ce7d8..a529a3b 100644 --- a/src/views/components/buttons/button-groups/ButtonGroups.js +++ b/src/views/components/buttons/button-groups/ButtonGroups.js @@ -13,7 +13,7 @@ import { CCardHeader, CCol, CFormCheck, - CFormControl, + CFormInput, CInputGroup, CInputGroupText, CRow, @@ -220,7 +220,7 @@ const ButtonGroups = () => { @ - { @ - { @@ -106,25 +106,18 @@ const ChecksRadios = () => { attribute.

- - + - - { - - + - {

- Wrap a pair of <CFormControl> and <CFormLabel>{' '} + Wrap a pair of <CFormInput> and <CFormLabel>{' '} elements in CFormFloating to enable floating labels with textual form - fields. A placeholder is required on each{' '} - <CFormControl> as our method of CSS-only floating labels uses the{' '} - :placeholder-shown pseudo-element. Also note that the{' '} - <CFormControl> must come first so we can utilize a sibling selector - (e.g., ~). + fields. A placeholder is required on each <CFormInput>{' '} + as our method of CSS-only floating labels uses the :placeholder-shown{' '} + pseudo-element. Also note that the <CFormInput> must come first so + we can utilize a sibling selector (e.g., ~).

- + Email address - - Password + + Password

@@ -49,7 +49,7 @@ const FloatingLabels = () => {

- {

- By default, <CFormControl component="textarea">s will be - the same height as <CFormControl>s. + By default, <CFormTextarea>s will be the same height as{' '} + <CFormInput>s.

- + > Comments

- To set a custom height on your{' '} - <CFormControl component="textarea">, do not use the{' '} + To set a custom height on your <CFormTextarea;>, do not use the{' '} rows attribute. Instead, set an explicit height (either inline or via custom CSS).

- + > Comments @@ -108,9 +105,9 @@ const FloatingLabels = () => {

- Other than <CFormControl>, floating labels are only available on{' '} + Other than <CFormInput>, floating labels are only available on{' '} <CFormSelect>s. They work in the same way, but unlike{' '} - <CFormControl>s, they'll always show the{' '} + <CFormInput>s, they'll always show the{' '} <CFormLabel> in its floated state.{' '} Selects with size and multiple are not supported. @@ -144,7 +141,7 @@ const FloatingLabels = () => { - {

Email address - {
Example textarea - +
@@ -58,20 +55,20 @@ const FormControl = () => { size="sm".

-
-
- { appearance and remove pointer events.

-
- { but retain the standard cursor.

- { Email
- { Password
- +
@@ -174,7 +171,7 @@ const FormControl = () => { Email - { Password - +
@@ -207,23 +204,23 @@ const FormControl = () => {
Default file input example - +
Multiple files input example - +
Disabled file input example - +
Small file input example - +
Large file input example - +
@@ -237,7 +234,7 @@ const FormControl = () => { Color picker - { @ - - { Your vanity URL https://example.com/users/ - + $ - + .00 - + @ - + With textarea - + @@ -91,7 +92,7 @@ const Select = () => { @ - { Small - Default - Large - @@ -159,7 +160,7 @@ const Select = () => { aria-label="Checkbox for following text input" /> - + @@ -169,7 +170,7 @@ const Select = () => { aria-label="Radio button for following text input" /> - + @@ -182,15 +183,15 @@ const Select = () => {

- While multiple <CFormControl>s are supported visually, validation + While multiple <CFormInput>s are supported visually, validation styles are only available for input groups with a single{' '} - <CFormControl>. + <CFormInput>.

First and last name - - + +
@@ -210,10 +211,10 @@ const Select = () => { $ 0.00 - + - + $ 0.00 @@ -236,14 +237,14 @@ const Select = () => { Button -
- { Button - + - @@ -297,10 +298,10 @@ const Select = () => { Separated link - + - + Dropdown @@ -327,7 +328,7 @@ const Select = () => { Separated link - + Dropdown @@ -366,10 +367,10 @@ const Select = () => { Separated link - + - + Action @@ -454,10 +455,10 @@ const Select = () => { Upload - + - + Upload @@ -471,7 +472,7 @@ const Select = () => { > Button
- { /> - { - + - + @@ -55,10 +55,10 @@ const Layout = () => { - + - + @@ -67,41 +67,41 @@ const Layout = () => {

- + Email - + - + Password - + - + Address - + - + Address 2 - + - + City - + - + State - + Zip - + - + - + Sign in @@ -133,21 +133,21 @@ const Layout = () => { Email - - + + Password - - + +
Radios - + { > Email - - + { Email - - + + @@ -227,8 +227,8 @@ const Layout = () => { > Email - - + {

- - + + - + - + @@ -288,7 +288,7 @@ const Layout = () => { Name - +
@@ -296,7 +296,7 @@ const Layout = () => { @ - + @@ -323,22 +323,22 @@ const Layout = () => {

- + Name - + - + Username @ - + - + Preference @@ -376,16 +376,16 @@ const Layout = () => {

- + Username @ - + - + Preference @@ -396,10 +396,10 @@ const Layout = () => { - + - + Submit diff --git a/src/views/components/forms/range/Range.js b/src/views/components/forms/range/Range.js index d07dd8f..163525c 100644 --- a/src/views/components/forms/range/Range.js +++ b/src/views/components/forms/range/Range.js @@ -16,7 +16,7 @@ const Range = () => {

Create custom <input type="range"> controls with{' '} - <CFormControl>. + <CFormRange>.

Example range diff --git a/src/views/components/forms/validation/Validation.js b/src/views/components/forms/validation/Validation.js index 001b4a2..28538d8 100644 --- a/src/views/components/forms/validation/Validation.js +++ b/src/views/components/forms/validation/Validation.js @@ -7,10 +7,11 @@ import { CCol, CForm, CFormCheck, - CFormControl, + CFormInput, CFormFeedback, CFormLabel, CFormSelect, + CFormTextarea, CInputGroup, CInputGroupText, CRow, @@ -34,21 +35,21 @@ const CustomStyles = () => { validated={validated} onSubmit={handleSubmit} > - + Email - + Looks good! - + Email - + Looks good! - + Username @ - { Please choose a username. - + City - + Please provide a valid city. - + City @@ -71,12 +72,12 @@ const CustomStyles = () => { Please provide a valid city. - + City - + Please provide a valid zip. - + { /> You must agree before submitting. - + Submit form @@ -106,21 +107,21 @@ const BrowserDefaults = () => { } return ( - + Email - + Looks good! - + Email - + Looks good! - + Username @ - { Please choose a username. - + City - + Please provide a valid city. - + City @@ -143,12 +144,12 @@ const BrowserDefaults = () => { Please provide a valid city. - + City - + Please provide a valid zip. - + { /> You must agree before submitting. - + Submit form @@ -183,25 +184,25 @@ const Tooltips = () => { validated={validated} onSubmit={handleSubmit} > - + Email - + Looks good! - + Email - + Looks good! - + Username @ - { - + City - + Please provide a valid city. - + City - + City - + Please provide a valid zip. - + Submit form @@ -316,9 +317,9 @@ const Validation = () => {

- + Email - { /> Looks good! - + Email - { /> Looks good! - + Username @ - { Please choose a username. - + City - + Please provide a valid city. - + City @@ -366,12 +367,12 @@ const Validation = () => { Please provide a valid city. - + City - + Please provide a valid zip. - + { /> You must agree before submitting. - + Submit form @@ -402,7 +403,7 @@ const Validation = () => {

  • - <CFormControl>s + <CFormInput>s
  • <CFormSelect>s @@ -417,13 +418,12 @@ const Validation = () => { Textarea - + > Please enter a message in the textarea.
{
- { export const getIconsView = (iconset) => { return Object.entries(iconset).map(([name, value]) => ( - +
{toKebabCase(name)}
diff --git a/src/views/components/widgets/Widgets.js b/src/views/components/widgets/Widgets.js index 71f677c..355fe94 100644 --- a/src/views/components/widgets/Widgets.js +++ b/src/views/components/widgets/Widgets.js @@ -23,7 +23,7 @@ const Widgets = () => { <> - + { text="Lorem ipsum dolor sit amet enim." /> - + { text="Lorem ipsum dolor sit amet enim." /> - + { text="Lorem ipsum dolor sit amet enim." /> - + { /> - + { text="Lorem ipsum dolor sit amet enim." /> - + { text="Lorem ipsum dolor sit amet enim." /> - + { text="Lorem ipsum dolor sit amet enim." /> - + { - + } @@ -124,7 +124,7 @@ const Widgets = () => { color="primary" /> - + } @@ -134,7 +134,7 @@ const Widgets = () => { color="info" /> - + } @@ -144,7 +144,7 @@ const Widgets = () => { color="warning" /> - + } @@ -154,7 +154,7 @@ const Widgets = () => { color="danger" /> - + } @@ -175,7 +175,7 @@ const Widgets = () => { } /> - + } @@ -196,7 +196,7 @@ const Widgets = () => { } /> - + } @@ -217,7 +217,7 @@ const Widgets = () => { } /> - + } @@ -238,7 +238,7 @@ const Widgets = () => { } /> - + { color="primary" /> - + { color="info" /> - + { color="warning" /> - + { /> - + } value="87.500" @@ -332,7 +332,7 @@ const Widgets = () => { className="mb-4" /> - + } value="385" @@ -342,7 +342,7 @@ const Widgets = () => { className="mb-4" /> - + } value="1238" @@ -352,7 +352,7 @@ const Widgets = () => { className="mb-4" /> - + } value="28%" @@ -362,7 +362,7 @@ const Widgets = () => { className="mb-4" /> - + } value="5:34:11" @@ -372,7 +372,7 @@ const Widgets = () => { className="mb-4" /> - + } value="972" @@ -384,7 +384,7 @@ const Widgets = () => { - + } @@ -395,7 +395,7 @@ const Widgets = () => { className="mb-4" /> - + } @@ -406,7 +406,7 @@ const Widgets = () => { className="mb-4" /> - + } @@ -417,7 +417,7 @@ const Widgets = () => { className="mb-4" /> - + } @@ -428,7 +428,7 @@ const Widgets = () => { className="mb-4" /> - + } @@ -439,7 +439,7 @@ const Widgets = () => { className="mb-4" /> - + } @@ -452,7 +452,7 @@ const Widgets = () => { - + { /> - + { /> - + { /> - + { /> - + { /> - + { return ( - + { /> - + { /> - + { /> - + { return ( - + { } /> - + { } /> - + { } /> - + { - +

Traffic

January - July 2021
- + @@ -184,15 +184,15 @@ const Dashboard = () => { Traffic {' & '} Sales - + - +
New Clients
9,123
- +
Recurring Clients
22,643
@@ -267,15 +267,15 @@ const Dashboard = () => {
- + - +
Pageviews
78,623
- +
Organic
49,123
diff --git a/src/views/pages/login/Login.js b/src/views/pages/login/Login.js index 769ee5e..ab0afb5 100644 --- a/src/views/pages/login/Login.js +++ b/src/views/pages/login/Login.js @@ -8,7 +8,7 @@ import { CCol, CContainer, CForm, - CFormControl, + CFormInput, CInputGroup, CInputGroupText, CRow, @@ -20,7 +20,7 @@ const Login = () => {
- + @@ -31,25 +31,25 @@ const Login = () => { - + - - + Login - + Forgot password? diff --git a/src/views/pages/page404/Page404.js b/src/views/pages/page404/Page404.js index 9d74359..87345ec 100644 --- a/src/views/pages/page404/Page404.js +++ b/src/views/pages/page404/Page404.js @@ -3,7 +3,7 @@ import { CButton, CCol, CContainer, - CFormControl, + CFormInput, CInputGroup, CInputGroupText, CRow, @@ -15,7 +15,7 @@ const Page404 = () => {
- +

404

Oops! You{"'"}re lost.

@@ -27,7 +27,7 @@ const Page404 = () => { - + Search diff --git a/src/views/pages/page500/Page500.js b/src/views/pages/page500/Page500.js index c7925b6..e9c52b6 100644 --- a/src/views/pages/page500/Page500.js +++ b/src/views/pages/page500/Page500.js @@ -3,7 +3,7 @@ import { CButton, CCol, CContainer, - CFormControl, + CFormInput, CInputGroup, CInputGroupText, CRow, @@ -15,7 +15,7 @@ const Page500 = () => {
- +

500

Houston, we have a problem!

@@ -27,7 +27,7 @@ const Page500 = () => { - + Search
diff --git a/src/views/pages/register/Register.js b/src/views/pages/register/Register.js index cc9fc63..4882b34 100644 --- a/src/views/pages/register/Register.js +++ b/src/views/pages/register/Register.js @@ -6,7 +6,7 @@ import { CCol, CContainer, CForm, - CFormControl, + CFormInput, CInputGroup, CInputGroupText, CRow, @@ -18,7 +18,7 @@ const Register = () => {
- + @@ -28,17 +28,17 @@ const Register = () => { - + @ - + - { - { const ThemeColor = ({ className, children }) => { const classes = classNames(className, 'theme-color w-75 rounded mb-3') return ( - +
{children}