ui(404): improve 404 page styling

This commit is contained in:
Dhanush Adithya
2020-08-07 01:58:43 -04:00
committed by Jean-Philippe Sirois
parent 2f81f5778b
commit fadb031f70
6 changed files with 51 additions and 9 deletions
+5 -3
View File
@@ -95,11 +95,14 @@ export const PossibleCorrections: FC<IPossibleCorrections> = ({
}) })
// helpful message if no matches found // helpful message if no matches found
const found = displayArray.length === 0 ? "Oops, nothing similar found." : "" const found = displayArray.length === 0 ? <SC.StyledFound>Oops, nothing similar found.</SC.StyledFound> : ""
return ( return (
<Fragment> <Fragment>
<h3>Based off of "{search}" you may have meant:</h3> <SC.StyledDiv>
<h3>Based off of "{search}" you may have meant:</h3>
{found}
</SC.StyledDiv>
<ul> <ul>
{displayArray.map((value, index) => { {displayArray.map((value, index) => {
return ( return (
@@ -111,7 +114,6 @@ export const PossibleCorrections: FC<IPossibleCorrections> = ({
) )
})} })}
</ul> </ul>
{found}
</Fragment> </Fragment>
) )
} }
@@ -14,3 +14,13 @@ export const StyledLink = styled(Link)`
transition: none; transition: none;
} }
` `
export const StyledFound = styled.div`
margin: 13px 10px 10px;
padding: 10px;
`
export const StyledDiv = styled.div`
width: 100%;
display: flex;
align-items: center;
justify-content: center;
`
+5 -2
View File
@@ -1,4 +1,5 @@
import React, { Fragment } from "react" import React, { Fragment } from "react"
import * as SC from "./styles"
import { SEO } from "../components/SEO" import { SEO } from "../components/SEO"
@@ -6,8 +7,10 @@ function NotFoundPage() {
return ( return (
<Fragment> <Fragment>
<SEO title="404: Not found" /> <SEO title="404: Not found" />
<h1>NOT FOUND</h1> <SC.StyledDiv>
<p>You just hit a route that doesn&#39;t exist... the sadness.</p> <SC.StyledH1>NOT FOUND</SC.StyledH1>
<SC.StyledPara>You just hit a route that doesn&#39;t exist... the sadness.</SC.StyledPara>
</SC.StyledDiv>
</Fragment> </Fragment>
) )
} }
+5 -2
View File
@@ -1,6 +1,7 @@
import { Location } from "@reach/router" import { Location } from "@reach/router"
import { graphql } from "gatsby" import { graphql } from "gatsby"
import React, { Fragment } from "react" import React, { Fragment } from "react"
import * as SC from "../styles"
import { FileConnection } from "../../../generated/graphql" import { FileConnection } from "../../../generated/graphql"
import { ComponentQuery } from "../../../typings" import { ComponentQuery } from "../../../typings"
@@ -11,8 +12,10 @@ import { PossibleCorrections } from "../../components/404LinkCorrection"
export default ({ data }: ComponentQuery<{ allFile: FileConnection }>) => ( export default ({ data }: ComponentQuery<{ allFile: FileConnection }>) => (
<Fragment> <Fragment>
<SEO title="404: Archive Not found" /> <SEO title="404: Archive Not found" />
<h1>RESOURCE NOT FOUND</h1> <SC.StyledDiv>
<p>You just hit a route that doesn&#39;t exist... the sadness.</p> <SC.StyledH1>RESOURCE NOT FOUND</SC.StyledH1>
<SC.StyledPara>You just hit a route that doesn&#39;t exist... the sadness.</SC.StyledPara>
</SC.StyledDiv>
<Location> <Location>
{({ location }) => ( {({ location }) => (
<PossibleCorrections <PossibleCorrections
+5 -2
View File
@@ -1,6 +1,7 @@
import { Location } from "@reach/router" import { Location } from "@reach/router"
import { graphql } from "gatsby" import { graphql } from "gatsby"
import React, { Fragment } from "react" import React, { Fragment } from "react"
import * as SC from "../styles"
import { FileConnection } from "../../../generated/graphql" import { FileConnection } from "../../../generated/graphql"
import { ComponentQuery } from "../../../typings" import { ComponentQuery } from "../../../typings"
@@ -10,8 +11,10 @@ import { SEO } from "../../components/SEO"
export default ({ data }: ComponentQuery<{ allFile: FileConnection }>) => ( export default ({ data }: ComponentQuery<{ allFile: FileConnection }>) => (
<Fragment> <Fragment>
<SEO title="404: Resource Not found" /> <SEO title="404: Resource Not found" />
<h1>RESOURCE NOT FOUND</h1> <SC.StyledDiv>
<p>You just hit a route that doesn&#39;t exist... the sadness.</p> <SC.StyledH1>RESOURCE NOT FOUND</SC.StyledH1>
<SC.StyledPara>You just hit a route that doesn&#39;t exist... the sadness.</SC.StyledPara>
</SC.StyledDiv>
<Location> <Location>
{({ location }) => ( {({ location }) => (
<PossibleCorrections <PossibleCorrections
+21
View File
@@ -0,0 +1,21 @@
import styled from "styled-components"
export const StyledDiv = styled.div`
width: 100%;
padding: 20px;
padding-top: 100px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
`
export const StyledH1 = styled.h1`
margin: 0;
padding: 10px;
line-height: 2.5rem;
`
export const StyledPara = styled.p`
margin: 0;
padding: 10px;
line-height: 2rem;
`