forked from caprover/caprover-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refacto(login) WIP refactoring more accessible, resilient, maintainab…
…le and lighter frontend
- Loading branch information
1 parent
b20b15b
commit f5376aa
Showing
12 changed files
with
13,292 additions
and
12,440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,3 @@ PORT=4500 | |
REACT_APP_API_URL=http://127.0.0.1:3000 | ||
REACT_APP_IS_DEBUG=TRUE | ||
REACT_APP_DEFAULT_PASSWORD=captain42 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:root { | ||
--main-bg-color: white; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.card-class { | ||
background-color: var(--main-bg-color); | ||
border-radius: 1rem; | ||
padding: 0; | ||
} | ||
|
||
.card-class>header { | ||
padding: 1rem; | ||
min-height: 48px; | ||
border-bottom: 1px solid rgb(240,240,240); | ||
} | ||
.card-class>header>h1 { | ||
color: rgba(0,0,0,0.8); | ||
font-size: 1.2em; | ||
} | ||
.card-class>main { | ||
margin-top: 1rem; | ||
padding: 1rem; | ||
font-size: 1em; | ||
color: rgba(255,255,255,0.9); | ||
font-size: 0.8rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// @ts-ignore | ||
import styles from './Card.css' | ||
import React, { CSSProperties, ReactComponentElement } from 'react' | ||
const classNames = require('classnames') | ||
|
||
export interface CardProps { | ||
title?: string, | ||
style?: CSSProperties, | ||
} | ||
classNames.bind(styles) | ||
|
||
export default class Card extends React.Component<CardProps> { | ||
render(): ReactComponentElement<any> { | ||
const cardClass = classNames({ | ||
'card-class': true | ||
}) | ||
return ( | ||
<article style={this.props.style} className={cardClass}> | ||
<header><h1>{this.props.title}</h1></header> | ||
<main> | ||
{this.props.children} | ||
</main> | ||
</article> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// @ts-ignore | ||
import styles from './primaryButton.css' | ||
import React, { CSSProperties, ReactComponentElement } from 'react' | ||
const classNames = require('classnames') | ||
|
||
export enum buttonType { | ||
PRIMARY = 'primary', | ||
SECONDARY = 'secondary' | ||
} | ||
|
||
export interface FormButtonProps { | ||
type?: buttonType, | ||
style?: CSSProperties, | ||
value: string | ||
} | ||
classNames.bind(styles) | ||
|
||
export default class SubmitButton extends React.Component<FormButtonProps> { | ||
render(): ReactComponentElement<any> { | ||
const submitClass = classNames({ | ||
'submit-class': true | ||
}) | ||
return ( | ||
<input className={ submitClass } type="submit" value={this.props.value}/> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.submit-class { | ||
opacity: 1; | ||
color: rgb(255, 255, 255); | ||
background: rgb(27, 138, 211); | ||
border: none; | ||
border-radius: 10px; | ||
text-shadow: rgb(0 0 0 / 12%) 0px -1px 0px; | ||
box-shadow: rgb(0 0 0 / 4%) 0px 2px 0px; | ||
height: 2rem; | ||
line-height: 2rem; | ||
padding: 0 1rem; | ||
cursor: pointer | ||
} | ||
.submit-class:hover { | ||
opacity: .8; | ||
transition: opacity .8s ease-out; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.radio-button { | ||
list-style-type: none; | ||
line-height: 2rem; | ||
padding-inline-start: 0; | ||
margin: 0; | ||
} | ||
|
||
.radio-button-input { | ||
vertical-align: top; | ||
margin-right: 0.5rem; | ||
width: 1rem; | ||
height: 1rem; | ||
cursor: pointer; | ||
} | ||
|
||
.radio-button-label { | ||
vertical-align: top; | ||
cursor: pointer; | ||
line-height: 1rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// @ts-ignore | ||
import styles from './radioButton.css' | ||
import React, { CSSProperties, ReactComponentElement } from 'react' | ||
const classNames = require('classnames') | ||
|
||
export interface ElementDisplay { | ||
value: string | number, | ||
legend: string, | ||
} | ||
|
||
export interface RadioButtonProps { | ||
name: string | ||
value: string | number | ||
legend?: string, | ||
style?: CSSProperties, | ||
onChange?: React.ChangeEventHandler<HTMLInputElement> | ||
listOfValues: Array<ElementDisplay> | ||
} | ||
classNames.bind(styles) | ||
|
||
classNames({ | ||
'radio-button': true, | ||
'radio-button-input': true, | ||
'radio-button-label': true, | ||
}) | ||
|
||
const displayLegend = (elementDisplay: RadioButtonProps): React.ReactFragment => { | ||
if (elementDisplay.legend) { | ||
return (<legend>{elementDisplay.legend}</legend>) | ||
} | ||
return (<></>) | ||
} | ||
|
||
const displayRadioButton = (elementDisplay: ElementDisplay, props: RadioButtonProps): React.ReactFragment => ( | ||
<li | ||
key={props.name + elementDisplay.value + props.value}> | ||
<input type="radio" | ||
className={'radio-button-input'} | ||
id={ props.name + elementDisplay.value} | ||
name={ props.name} | ||
value={elementDisplay.value} | ||
onChange={props.onChange} | ||
checked={ elementDisplay.value.toString() === props.value.toString() } | ||
/> | ||
<label | ||
className={'radio-button-label'} | ||
htmlFor={ props.name + elementDisplay.value}>{elementDisplay.legend}</label> | ||
</li> | ||
) | ||
|
||
|
||
|
||
export default class SubmitButton extends React.Component<RadioButtonProps> { | ||
render(): ReactComponentElement<any> { | ||
return ( | ||
<fieldset> | ||
{displayLegend(this.props)} | ||
<ul className={'radio-button'}> | ||
{this.props.listOfValues.map(display => displayRadioButton(display, this.props))} | ||
</ul> | ||
</fieldset> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.