added generic html website

This commit is contained in:
alex 3
2023-04-09 19:50:30 -04:00
parent 4404a43c18
commit 8709797b89
19 changed files with 448 additions and 29494 deletions
-39
View File
@@ -1,39 +0,0 @@
import React from 'react';
import {Routes,BrowserRouter,Route} from 'react-router-dom';
import {NavBar,Footer} from "./Components";
import {HomePage,ContactPage,NotFound} from "./Pages";
const pages = [
{
"slug": "home",
"path": "/"
},
{
"slug": "contact",
"path": "/contact"
}
]
export class App extends React.Component {
renderPageLinks() {
return pages.map((page) => {
return <a href={page.path} key={page.slug} rel={"noreferrer"} target={"_self"}><li className={"nav-links"}>{page.slug}</li></a>
})
}
render() {
return (
<div id={"container"}>
<NavBar pages={this.renderPageLinks()} />
<BrowserRouter>
<Routes>
<Route path={"/"} element={<HomePage />} />
<Route path={"/contact"} element={<ContactPage />} />
<Route path={"*"} element={<NotFound />} />
</Routes>
</BrowserRouter>
<Footer />
</div>
)
}
}
-59
View File
@@ -1,59 +0,0 @@
import React from 'react';
import {Href} from './Utilities'
export class NavBar extends React.Component {
render() {
return (
<div id={"nav"}>
<ul style={{ paddingLeft:"0px" }} id={"nav-items"}>
{this.props.pages}
<div className={"social"}>
<a href={"https://twitter.com/zstreamss"} target={"_blank"} rel={"noreferrer"}>
<i className="fa-brands fa-twitter" aria-hidden="true"></i>
</a>
<a href={"https://social.thatalex.dev"} target={"_blank"} rel={"noreferrer"}>
<i className={"fa-brands fa-mastodon"} aria-hidden={"true"} />
</a>
<a href={"https://github.com/azpha"} target={"_blank"} rel={"noreferrer"}>
<i className="fa-brands fa-github" aria-hidden="true"></i>
</a>
<a href={"https://linkedin.com/in/thatalex"} target={"_blank"} rel={"noreferrer"}>
<i className="fa-brands fa-linkedin-in" aria-hidden="true"></i>
</a>
<a href={"mailto:hi@thatalex.dev"} target={"_blank"} rel={"noreferrer"}>
<i className="fa fa-envelope" aria-hidden="true"></i>
</a>
</div>
</ul>
</div>
)
}
}
export class Footer extends React.Component {
render() {
return (
<div id={"footer"}>
<p>Made with <i style={{color:"red"}} className={"fa-solid fa-heart"} /> & <i style={{color:"gray"}} className={"fa-solid fa-music"} /> by Alex</p>
<p><Href url={"https://github.com/azpha/website"} tab={"_blank"} content={"Source Code"} /></p>
</div>
)
}
}
export class ShowcaseCard extends React.Component {
render() {
if (this.props.header && this.props.paragraph) return (
<div id={"card"}>
<div id={"card-content"}>
<div id={"card-header"}>
{this.props.url ? <Href url={this.props.url} tab={"_blank"} content={<h1>{this.props.header}</h1>} /> : <h1>{this.props.header}</h1>}
</div>
<div id={"card-paragraph"}>
<p>{this.props.paragraph}</p>
</div>
</div>
</div>
)
}
}
-94
View File
@@ -1,94 +0,0 @@
import React from 'react';
import {ShowcaseCard} from "./Components";
export class HomePage extends React.Component {
render() {
return (
<div id={"home"} className={"centered horizontally vertically"} style={{paddingBottom:"10%"}}>
<div style={{ textAlign:"center" }}>
<div id={"profile"}>
<img width={"100px"} alt={"Profile"} src={"https://pbs.twimg.com/profile_images/1587882255740985346/5knCQsEd_400x400.jpg"} />
<h1 style={{color:"white"}}>Alex</h1>
<p style={{color:"white"}}>Just about everything QA @ <a href={"https://medal.tv"}>Medal.tv</a></p>
</div>
<ShowcaseCard
url={"https://github.com/azpha/splitstat"}
header={"SplitStat"}
paragraph={"SplitStat was a Discord bot that interfaced with Tracker Network's API to return and compare SplitStat: Arena Warfare stats with others."}
/>
<ShowcaseCard
url={"https://pause.thatalex.dev"}
header={"Pause!"}
paragraph={"Pause my music. Website that controls my Spotify client using the full suite of controls; skip, pause, repeat, shuffle, volume, you name it!"}
/>
<ShowcaseCard
url={"https://donotbro.me"}
header={"donotbrome"}
paragraph={"Just don't bro me. A website that one of my friends sparked me to make from starting conversations with one word; 'bro'."}
/>
</div>
</div>
)
}
}
export class ContactPage extends React.Component {
async sendMessage(event) {
event.preventDefault()
let data = new FormData(event.target)
return fetch("https://ash-api.thatalex.dev/v3/tools/contact", {
method: "POST",
headers: {
'content-type': "application/json"
},
body: JSON.stringify({
"name": data.get("name"),
"email": data.get("email"),
"subject": "Website form submission",
"message": data.get("message")
})
})
.then(result => {
if (result.ok) window.location.href="/?contact=success"
else return window.location.href="?contact=fail";
})
.catch(err => {
console.log('Contact request failed with error "' + err.message + '"');
return window.location.href="?contact=fail";
})
}
render() {
return (
<div id={"contact"} className={"centered horizontally vertically"}>
<div id={"form-container"}>
<h1 style={{whiteSpace: "nowrap"}}>lets get in touch</h1>
<br />
<form onSubmit={this.sendMessage} style={{textAlign:"center"}}>
<label htmlFor={"name"}>Name:</label><br />
<input type={"name"} id={"name"} name={"name"} /><br />
<label htmlFor={"email"}>Email:</label><br />
<input type={"email"} id={"email"} name={"email"} /><br />
<label htmlFor={"message"}>Message:</label><br />
<input type={"message"} id={"message"} name={"message"} /><br />
<input type="submit" value="Submit" />
</form>
</div>
</div>
)
}
}
export class NotFound extends React.Component {
render() {
return (
<div id={"error"} className={"centered horizontally vertically"} style={{bottom:"10%", lineHeight:"1.5em", color:"white", textAlign:"center"}}>
<video autoPlay={true} loop={true} style={{pointerEvents: "none", width:"500px"}}>
<source src={"https://storage.thatalex.dev/content/polar_bear-v2.mp4"} type={"video/mp4"} />
</video>
<h1>Well, this is awkward..</h1>
<p>You've landed on a page that just doesn't exist.<br />Enjoy this low-quality polar bear, traveller. You'll need it.</p>
</div>
)
}
}
-2
View File
@@ -1,2 +0,0 @@
import { io } from 'socket.io-client';
export const socket = io("https://api.zephmakes.tech");
-41
View File
@@ -1,41 +0,0 @@
import React from 'react';
import {NotFound} from './Pages';
export class Href extends React.Component {
render() {
if (this.props.url && this.props.content && this.props.tab) return (
<a
href={this.props.url}
rel={"noreferrer"}
target={this.props.tab}
>{this.props.content}</a>
)
}
}
export class Redirector extends React.Component {
constructor(props) {
super(props);
this.state = {
redirectTo: props.url,
success: null
}
}
async componentDidMount() {
if (this.state.redirectTo) {
window.location.href = this.state.redirectTo;
this.state.success = true;
}
else await this.setState({success:false});
console.log(this.state)
}
render() {
return (
<div id={"redirector"}>
{!this.state.success ? <NotFound /> : null}
</div>
)
}
}
-12
View File
@@ -1,12 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
// components/global styling
import { App } from './App';
import './main.css';
// react 18 compliance
const root = ReactDOM.createRoot(document.getElementById("root"))
root.render(
<App />
)
-175
View File
@@ -1,175 +0,0 @@
/* css reset */
html, body, ul, h1, h2, h3, h4 {
margin:0;
padding:0;
}
html,body {
background-color:black;
font-family: 'Open Sans', sans-serif;
overflow-x:hidden;
}
/* global */
a {
color:white;
text-decoration:none;
}
a:hover {
color:gray;
}
.centered {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: absolute;
z-index:-1;
}
.horizontally {
margin-left:auto;
margin-right:auto;
left:0;
right:0;
}
.vertically {
margin-top:0;
margin-bottom:0;
top:0;
bottom:0;
}
input[type="text"],
input[type="email"],
textarea {
background-color: white;
border: 1px solid gray;
color: black;
}
input[type="submit"] {
background-color: black;
border: none;
color: white;
}
/*components*/
#contact {
padding-bottom:5%;
}
#form-container {
background-color:white;
border-radius:10px;
border-style:solid;
border-color:gray;
padding: 5vw 5vh;
}
#form {
width:30vw;
padding:110px 100px;
background-color:gray;
border-radius:50px;
border-color:white;
border-style:solid;
}
#card {
display:inline-block;
margin:auto;
padding:10px;
text-align:center;
vertical-align: top;
}
#card-content {
background-color:black;
border-radius:50px;
border-style:solid;
color:#bfbfbf;
width:300px;
height:200px;
}
#card-header {
padding-top:20px;
font-size:15px;
}
#card-paragraph {
font-size:15px;
padding:0 10px;
}
@media only screen and (max-width:655px) {
#profile {
padding-top:10%;
}
}
/* nav bar */
#nav {
background-color:black;
text-align:left;
padding-left:15px;
overflow-y:hidden;
}
#nav-items ul {
list-style-type:none;
list-style-position:inside;
}
#nav-items li {
display:inline-block;
padding:10px;
font-size:20px;
}
#nav-items a {
color:white;
}
#nav-items a:hover {
color:gray;
}
.social {
padding:6px;
float:right;
font-size:25px;
}
.social a {
padding:10px 8px;
color:white;
}
.social a:hover {
color:gray;
}
@media only screen and (max-width:500px) {
.social {
display:none;
}
#nav {
padding-left:15px;
}
}
/* footer */
#footer {
text-align:center;
color:white;
background-color:#121212;
padding:20px;
position:fixed;
bottom:0;
left:0;
right:0;
line-height:0.1;
}
#footer a {
color:white;
text-decoration:none;
}
#footer a:hover {
color:gray;
text-decoration:underline;
}
#footer a:visited {
color:white;
}
/* animations */
@keyframes hover {
from { opacity:1; }
to { opacity:0.5; }
}