-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: login and register page responsive #201
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,13 @@ | |
name="description" | ||
content="Web site created using create-react-app" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" | ||
crossorigin="anonymous" | ||
/> | ||
|
||
<!-- | ||
manifest.json provides metadata used when your web app is installed on a | ||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,8 @@ import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | ||
import { Link } from 'react-router-dom'; | ||
import { postLogin } from '../actions/login'; | ||
import { | ||
Form, | ||
Grid, | ||
Image, | ||
Divider, | ||
Icon, | ||
Message, | ||
Button, | ||
} from 'semantic-ui-react'; | ||
import { Form, Image, Divider, Icon, Message, Button } from 'semantic-ui-react'; | ||
import { Container } from 'react-bootstrap'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have imported here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I haven't used semantic-ui, So let me see how responsive containers work in semantic-ui. @codesankalp can I use bootstrap classes to make containers responsive? |
||
import PropTypes from 'prop-types'; | ||
import './../styles/Login.css'; | ||
import orgLogo from '../assets/org-logo.jpg'; | ||
|
@@ -112,80 +105,77 @@ class Login extends Component { | |
render() { | ||
const { showPassword, error, submitted } = this.state; | ||
return ( | ||
<> | ||
<Grid> | ||
<Grid.Row> | ||
<Grid.Column width={5}> | ||
<div className="login"> | ||
<span> | ||
<b>Login</b> | ||
</span> | ||
<Divider /> | ||
<Form> | ||
<Form.Input | ||
name="username" | ||
data-testid="input-username" | ||
value={this.state.username} | ||
onChange={this.onChange} | ||
label="Username" | ||
required | ||
placeholder="Enter your username..." | ||
<Container className="container d-flex align-items-center"> | ||
<Container | ||
className="remo d-flex flex-xl-row flex-lg-row flex-md-row flex-column-reverse align-items-center justify-content-center justify-content-xl-around justify-content-lg-around w-100" | ||
style={{ height: 'calc(100vh - 56px)' }} | ||
> | ||
<div className="login"> | ||
<span> | ||
<b>Login</b> | ||
</span> | ||
<Divider /> | ||
<Form> | ||
<Form.Input | ||
name="username" | ||
data-testid="input-username" | ||
value={this.state.username} | ||
onChange={this.onChange} | ||
label="Username" | ||
required | ||
placeholder="Enter your username..." | ||
/> | ||
<Form.Input | ||
data-testid="input-password" | ||
type={showPassword ? 'text' : 'password'} | ||
icon={ | ||
<Icon | ||
name={showPassword ? 'eye slash outline' : 'eye'} | ||
data-testid="hide-password" | ||
onClick={this.handleShow} | ||
link | ||
/> | ||
<Form.Input | ||
data-testid="input-password" | ||
type={showPassword ? 'text' : 'password'} | ||
icon={ | ||
<Icon | ||
name={showPassword ? 'eye slash outline' : 'eye'} | ||
data-testid="hide-password" | ||
onClick={this.handleShow} | ||
link | ||
/> | ||
} | ||
name="password" | ||
value={this.state.password} | ||
onChange={this.onChange} | ||
label="Password" | ||
required | ||
placeholder="Enter your password..." | ||
/> | ||
<Button | ||
data-testid="button-login" | ||
fluid | ||
primary | ||
type="button" | ||
onClick={this.submitLogin} | ||
disabled={!this.state.username || !this.state.password} | ||
> | ||
LOG IN | ||
</Button> | ||
</Form> | ||
} | ||
name="password" | ||
value={this.state.password} | ||
onChange={this.onChange} | ||
label="Password" | ||
required | ||
placeholder="Enter your password..." | ||
/> | ||
<Button | ||
data-testid="button-login" | ||
fluid | ||
primary | ||
type="button" | ||
onClick={this.submitLogin} | ||
disabled={!this.state.username || !this.state.password} | ||
> | ||
LOG IN | ||
</Button> | ||
</Form> | ||
|
||
{/* form validation */} | ||
{this.state.usernameerror ? ( | ||
<Message error content="Username cannot be empty!" /> | ||
) : null} | ||
{this.state.passworderror ? ( | ||
<Message error content="Password cannot be empty!" /> | ||
) : null} | ||
{error && submitted ? ( | ||
<Message error content={this.props.loginerror.detail} /> | ||
) : null} | ||
<Divider /> | ||
<span> | ||
Don't have an account? <Link to={register()}>Register here.</Link> | ||
</span> | ||
</div> | ||
|
||
{/* form validation */} | ||
{this.state.usernameerror ? ( | ||
<Message error content="Username cannot be empty!" /> | ||
) : null} | ||
{this.state.passworderror ? ( | ||
<Message error content="Password cannot be empty!" /> | ||
) : null} | ||
{error && submitted ? ( | ||
<Message error content={this.props.loginerror.detail} /> | ||
) : null} | ||
<Divider /> | ||
<span> | ||
Don't have an account?{' '} | ||
<Link to={register()}>Register here.</Link> | ||
</span> | ||
</div> | ||
</Grid.Column> | ||
<Grid.Column width={10}> | ||
<div className="logo"> | ||
<Image src={orgLogo} /> | ||
</div> | ||
</Grid.Column> | ||
</Grid.Row> | ||
</Grid> | ||
</> | ||
<div className="logo"> | ||
<Image src={orgLogo} /> | ||
</div> | ||
</Container> | ||
</Container> | ||
); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pankajsahu221 Why are you adding bootstrap 5 css link here? If you want to use bootstrap 5 then install it using npm and import it in the component.
Also see my below comment related to semantic-ui, I think we don't need to use react-bootstrap here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll fix that.