Skip to content

Commit

Permalink
Merge pull request #55 from marcoandre1/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
marcoandre1 authored Feb 21, 2021
2 parents 3055bfc + 78b7bd6 commit 2eb1aad
Show file tree
Hide file tree
Showing 28 changed files with 461 additions and 255 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
},
"homepage": "https://modokemdev.com",
"dependencies": {
"@headlessui/react": "^0.2.0",
"gh-pages": "^2.2.0",
"husky": "^4.3.6",
"lint-staged": "^10.5.3",
Expand Down
45 changes: 38 additions & 7 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import React, { Component } from "react";
import { BrowserRouter, Route } from "react-router-dom";
import { BrowserRouter, Route, Switch, Redirect } from "react-router-dom";
import { Provider } from "react-redux";
import { store } from "./store";
import { ConnectedDashboard } from "./components/Dashboard";
import { ConnectedNavigation } from "./components/Navigation";
import { ConnectedFooter } from "./components/Footer";
import NoMatch from "./components/NoMatch";

class App extends Component {
constructor() {
super();
this.state = {
isDarkMode: false,
isMenuOpen: false,
isTranslateMenuOpen: false,
};
// Binding method
this.onDarkModeToggle = this.onDarkModeToggle.bind(this);
this.onMobileMenuClick = this.onMobileMenuClick.bind(this);
this.onTranslateToggle = this.onTranslateToggle.bind(this);
}

componentDidMount() {
Expand All @@ -41,11 +44,27 @@ class App extends Component {
});
}

onTranslateToggle() {
this.setState({
isTranslateMenuOpen: !this.state.isTranslateMenuOpen,
});
}

onDarkModeToggle() {
if (document.querySelector("html").classList.contains("dark")) {
document.querySelector("html").classList.remove("dark");
if (localStorage.theme === undefined) {
localStorage.setItem("theme", "light");
} else {
localStorage.theme = "light";
}
} else {
document.querySelector("html").classList.add("dark");
if (localStorage.theme === undefined) {
localStorage.setItem("theme", "dark");
} else {
localStorage.theme = "dark";
}
}
this.setDarkMode();
}
Expand All @@ -68,15 +87,27 @@ class App extends Component {
onDarkModeToggle={this.onDarkModeToggle}
isMenuOpen={this.state.isMenuOpen}
onMobileMenuClick={this.onMobileMenuClick}
isTranslateMenuOpen={this.state.isTranslateMenuOpen}
onTranslateToggle={this.onTranslateToggle}
/>
</header>
<main>
<Route exact path={`/`} render={() => <ConnectedDashboard />} />
<Route
exact
path={`/:id`}
render={({ match }) => <ConnectedDashboard match={match} />}
/>
<Switch>
<Route exact path={`/`}>
<Redirect to="/en" />
</Route>
<Route
exact
path={`/:id`}
render={({ match }) => (
<ConnectedDashboard
match={match}
isDarkMode={this.state.isDarkMode}
/>
)}
/>
<Route exact path="/:id/*" render={() => <NoMatch />} />
</Switch>
</main>
<ConnectedFooter />
</Provider>
Expand Down
26 changes: 26 additions & 0 deletions src/components/BioCard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";

export default function BioCard({
id,
firstTitle,
firstContent,
secondTite,
secontContent,
}) {
return (
<div className="pt-6 md:p-8 text-center md:text-left space-y-4">
<div className="uppercase tracking-wide text-sm text-indigo-600 dark:text-gray-300 font-bold">
{firstTitle}
</div>
<p className="mt-2 mb-2 text-left text-gray-600 dark:text-gray-400">
{firstContent}
</p>
<div className="uppercase tracking-wide text-sm text-indigo-600 dark:text-gray-300 font-bold">
{secondTite}
</div>
<p className="mt-2 mb-2 text-left text-gray-600 dark:text-gray-400">
{secontContent}
</p>
</div>
);
}
4 changes: 1 addition & 3 deletions src/components/DarkModeButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ const DarkModeButton = ({ isDarkMode, onDarkModeToggle }) => {
aria-checked={isDarkMode}
tabIndex="0"
onClick={onDarkModeToggle}
className={`${
isDarkMode ? "bg-indigo-600" : "bg-gray-500"
} relative inline-block flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:shadow-outline`}
className="bg-gray-500 dark:bg-indigo-600 relative inline-block flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:shadow-outline"
>
<span
aria-hidden="true"
Expand Down
25 changes: 14 additions & 11 deletions src/components/Dashboard.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
import React from "react";
import { connect } from "react-redux";
import { ConnectedTaskList } from "./TaskList";
import { ConnectedProjects } from "./Projects";
import { Helmet } from "react-helmet";
import PageNotFound from "./PageNotFound";

export const Dashboard = ({ id, language, isValidRequest }) => (
export const Dashboard = ({ id, language, isValidRequest, isDarkMode }) => (
<div>
<Helmet>
<title>{language.htmlTitle}</title>
</Helmet>
{isValidRequest && (
<div>
<h2 className="font-bold text-xl text-gray-900 dark:text-white mb-2 mt-2 px-6">
{language.title}
</h2>
<ConnectedTaskList
key={language.id}
id={language.id}
name={language.name}
description={language.description}
/>
<div>
<h2 className="font-bold text-xl text-gray-900 dark:text-white mb-2 mt-2 px-6">
{language.title}
</h2>
<ConnectedTaskList key={language.id} {...language} />
</div>
<div className="pt-3">
<h2 className="font-bold text-xl text-gray-900 dark:text-white mb-2 mt-2 px-6">
{language.subTitle}
</h2>
<ConnectedProjects isDarkMode={isDarkMode} language={language} />
</div>
</div>
)}
{!isValidRequest && (
Expand All @@ -36,7 +40,6 @@ function mapStateToProps(state, ownProps) {
let isValidRequest = true;

if (language === undefined) {
// id contains the /asdf
language = state.pageNotFound.find((notFound) => notFound.id === 404);
isValidRequest = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "react";

const Footer = () => (
<div className="bg-gray-200 dark:bg-gray-800 text-black dark:text-gray-300 rounded-md mt-6 p-6 flex justify-center">
Modokemdev © 2020
Modokemdev © 2021
</div>
);

Expand Down
16 changes: 16 additions & 0 deletions src/components/GitHubButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
import GitHubMark from "../images/GitHub-Mark-64px.png";
import GitHubMarkLight from "../images/GitHub-Mark-Light-64px.png";

export default function GitHubButton({ isDarkMode, repo }) {
return (
<div className="w-7">
<a href={repo}>
<img
src={isDarkMode ? GitHubMarkLight : GitHubMark}
alt="GitHub Mark"
/>
</a>
</div>
);
}
2 changes: 1 addition & 1 deletion src/components/MobileMenuButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const MobileMenuButton = ({ isMenuOpen, onMobileMenuClick }) => {
<button
onClick={onMobileMenuClick}
className="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white"
aria-expanded="false"
aria-expanded={isMenuOpen}
>
<span className="sr-only">Open main menu</span>
<svg
Expand Down
8 changes: 8 additions & 0 deletions src/components/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import { Link } from "react-router-dom";
import MobileMenuButton from "./MobileMenuButton";
import DarkModeButton from "./DarkModeButton";
import LogoMark from "./LogoMark";
import TranslateDropDown from "./TranslateDropDown";

const Navigation = ({
languages,
isMenuOpen,
onMobileMenuClick,
isDarkMode,
onDarkModeToggle,
isTranslateMenuOpen,
onTranslateToggle,
}) => (
<nav className="bg-gray-200 dark:bg-gray-800 rounded-md mb-6">
<div className="max-w-7xl mx-auto px-2 sm:px-6 lg:px-8">
Expand Down Expand Up @@ -40,6 +43,11 @@ const Navigation = ({
isDarkMode={isDarkMode}
onDarkModeToggle={onDarkModeToggle}
/>
<TranslateDropDown
isTranslateMenuOpen={isTranslateMenuOpen}
onTranslateToggle={onTranslateToggle}
languages={languages}
/>
</div>
</div>
</div>
Expand Down
26 changes: 26 additions & 0 deletions src/components/NoMatch.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";
import { useLocation } from "react-router-dom";

export default function NoMatch() {
let location = useLocation();

return (
<div className="flex justify-center">
<div class="h-screen -my-24 flex flex-wrap content-center">
<div className="max-w-sm rounded overflow-hidden shadow-lg">
<div className="px-6 py-4">
<h2 className="font-bold text-gray-900 dark:text-white mb-2 flex justify-center">
404 | This page could not be found.
</h2>
<h3 className="font-bold text-gray-600 dark:text-gray-300 flex justify-center">
No match for{" "}
<code className="bg-gray-200 dark:bg-indigo-600">
{location.pathname}
</code>
</h3>
</div>
</div>
</div>
</div>
);
}
6 changes: 3 additions & 3 deletions src/components/PageNotFound.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import React from "react";
export default function PageNotFound({ id }) {
return (
<div className="flex justify-center">
<div class="h-96 my-3 flex flex-wrap content-center">
<div class="h-screen -my-24 flex flex-wrap content-center">
<div className="max-w-sm rounded overflow-hidden shadow-lg">
<div className="px-6 py-4">
<h2 className="font-bold text-gray-900 dark:text-white mb-2 flex justify-center">
404 | Page not found
404 | This page could not be found.
</h2>
<div className="font-bold text-gray-600 dark:text-gray-300">
<div className="font-bold text-gray-600 dark:text-gray-300 flex justify-center">
The path,{" "}
<span className="bg-gray-200 dark:bg-indigo-600">/{id}</span>, did
not match any route.
Expand Down
32 changes: 32 additions & 0 deletions src/components/Project.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";
import GitHubButton from "./GitHubButton";
import ProjectImage from "./ProjectImage";

export default function Project({
id,
bio,
name,
image,
url,
repo,
isDarkMode,
language,
}) {
let description = bio.find((bio) => bio.language === language.id);
return (
<div className="bg-gray-100 dark:bg-gray-800 rounded overflow-hidden shadow-2xl p-6">
<div className="grid grid-cols-4 mb-6">
<div className="text-black dark:text-white hover:text-blue-700 dark:hover:text-indigo-300 font-bold text-lg col-span-3">
<a href={url}>{`${name}`}</a>
</div>
<div className="flex justify-end">
<GitHubButton isDarkMode={isDarkMode} repo={repo} />
</div>
</div>
<div className="mb-6">
<ProjectImage id={image} />
</div>
<div className="text-gray-600 dark:text-white">{description.text}</div>
</div>
);
}
14 changes: 14 additions & 0 deletions src/components/ProjectImage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from "react";
import { SimpleImg } from "react-simple-img";

export default function ProjectImage({ id }) {
return (
<SimpleImg
src={id}
animationDuration="1"
width={200}
height={130}
applyAspectRatio="true"
/>
);
}
16 changes: 16 additions & 0 deletions src/components/ProjectSearchBar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";

export default function ProjectSearchBar({ searchQuery, setSearchQuery }) {
return (
<div className="mb-6">
<input
className="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
id="username"
type="text"
placeholder="Search by name"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
/>
</div>
);
}
Loading

0 comments on commit 2eb1aad

Please sign in to comment.