Skip to content
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

UI: Design a 404 page for default redirects #57

Merged
merged 6 commits into from
Feb 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Login from './components/Login'
import Register from './components/Register'
import Dashboard from './components/Dashboard'
import Forms from './components/Forms'
import ErrorPage from './components/ErrorPage'
import Submission from './components/Submission'
import Questions from './components/Questions'
import { login, register, dashboard, forms, upload, submission, urlBaseFrontend } from './urls'
Expand All @@ -23,7 +24,7 @@ export default class Routes extends Component {
<AuthRoute path={login()} component={Login} />
<AuthRoute path={register()} component={Register} />
<Route path={upload()} component={Upload} />
<Route render={() => <Redirect to='/' />} />
<AuthRoute component={ErrorPage} />
</Switch>
</>
)
Expand Down
40 changes: 40 additions & 0 deletions src/components/ErrorPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React, { Component } from 'react'
import './../styles/ErrorPage.css'
import './../styles/App.css'
import { Header } from 'semantic-ui-react';

class ErrorPage extends Component {
render() {
return (
<div className="errorPage">
<div className="errorPage_content">
<Header
as='h1'
content='404'
style={{
color: '#2185D0',
fontSize: '10vw',
fontWeight: 'bolder',
lineHeight: '1em',
textTransform: 'uppercase',
}}
/>
<Header
as='h4'
content='Oops! Page Not Found'
style={{
fontSize: '2em',
marginBottom: '20px',
textTransform: 'uppercase',
maxWidth: '600px',
color: '#0d0d0d',
}}
/>
<p>Sorry, the page you were looking for doesn't exist. If you think something is wrong, try again.</p>
</div>
</div>
)
}
}

export default ErrorPage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughout the application class method has been used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aaishpra Make these changes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already done @bismitaguha

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bismitaguha is this correct now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

26 changes: 26 additions & 0 deletions src/styles/ErrorPage.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
* {
margin: 0;
padding: 0;
}

.errorPage {
position: absolute;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aaishpra Can I ask why are you using absolute positioning when this can be achieved with relative positioning as well. This way the overlapping issue on small screens mentioned by @codesankalp will also resolve.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relative is not gonna work on larger screen

top: 15%;
left: 17%;
right: 17%;
color: whitesmoke;
bottom: 20%;
display: flex;
align-items: center;
justify-content: center;
}

.errorPage_content {
max-width: 600px;
text-align: center;
}

.errorPage_content p {
font-size: 1.4em;
color: gray;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use className (err-num and err-text) instead of style={{}} for Header in ErrorPage.js and add the styles in ErrorPage.css as mentioned below?

Suggested change
}
}
.ui.header.err-num {
color: #2185D0;
font-size: 10vw;
font-weight: bolder;
line-height: 1em;
text-transform: uppercase;
}
.ui.header.err-text {
font-size: 2em;
margin-bottom: 20px;
text-transform: uppercase;
max-width: 600px;
color: #0d0d0d;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason @codesankalp ? Is this a common convention?