diff --git a/README.md b/README.md index eee9a08..242a594 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The components live under `/src/components`. ### Add / Change a Project Entry -All the projects are stored in the `projects.json` file in `/src/components/` +All the projects are stored in the `projects.json` file in `/src/data/` Here is an example of a project's entry: diff --git a/src/Home.tsx b/src/Home.tsx index a2ea3e7..9636f89 100644 --- a/src/Home.tsx +++ b/src/Home.tsx @@ -1,6 +1,7 @@ import EthLogo from './components/EthLogo'; import Starter from './components/Starter'; import Projects from './components/Projects'; +import Team from './components/Team'; import Footer from './components/Footer'; import './Home.css'; diff --git a/src/components/Projects.css b/src/components/CardSection.css similarity index 85% rename from src/components/Projects.css rename to src/components/CardSection.css index f2ed6ca..054f70a 100644 --- a/src/components/Projects.css +++ b/src/components/CardSection.css @@ -1,4 +1,4 @@ -.ProjectsList { +.Cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 2.5rem; diff --git a/src/components/CardSection.tsx b/src/components/CardSection.tsx new file mode 100644 index 0000000..12c1f98 --- /dev/null +++ b/src/components/CardSection.tsx @@ -0,0 +1,41 @@ +import React, { useState, useEffect } from 'react'; +import MagicCard, { MagicCardProps } from './MagicCard'; +import { shuffleFisherYates } from '../Utils'; +import './CardSection.css'; + +interface ICardSection { + title: string; + cardData: MagicCardProps[]; + shuffle?: boolean; + renderBanner?: boolean | undefined; +} + +function CreateCards(cards: MagicCardProps[], shuffle: boolean = true, renderBanner: boolean | undefined): JSX.Element[] { + let _cards = cards.map((card: MagicCardProps) => { + if (renderBanner == true) { + return ; + } else if (renderBanner == false) { + return ; + } + return ; + }) + + if (shuffle) { + _cards = shuffleFisherYates(_cards as []); + } + + return _cards +} + +function CardSection(props: ICardSection) { + let [cards] = useState([CreateCards(props.cardData, props.shuffle, props.renderBanner)]); + + return ( +
+

{props.title}

+
{cards}
+
+ ); +} + +export default CardSection; diff --git a/src/components/MagicCard.tsx b/src/components/MagicCard.tsx index e2af02e..609224b 100644 --- a/src/components/MagicCard.tsx +++ b/src/components/MagicCard.tsx @@ -6,13 +6,14 @@ import telegram from '../images/telegram.svg'; import './MagicCard.css'; import ColorHash from 'color-hash' -export interface CardProps { +export interface MagicCardProps { name: string; short_name?: string; description: string | string[]; long_description?: string | string[]; image?: string; links?: Links[]; + renderBanner?: boolean; } interface Links { @@ -34,13 +35,13 @@ function renderLink(url: string, source: string, icon: string): any { ); } -function renderImage(name: string): any { +function renderBanner(name: string): any { let hueRange = { min: 45, max: 360 } let colorHashText = new ColorHash({hue: hueRange, lightness: [0.8, 0.9]}).hex(name); let colorHashBG = new ColorHash({hue: hueRange, lightness: [0.35, 0.4], saturation: [0.65, 0.85, 1]}).hex(name); return ( - {name} + {name} ); } @@ -58,7 +59,7 @@ function renderDescription(description: string | string[]): any { }); } -function MagicCard(props: CardProps) { +function MagicCard(props: MagicCardProps) { let links = props.links ? props.links.map((link) => { if (link.github) { @@ -83,11 +84,19 @@ function MagicCard(props: CardProps) { return ( {props.name} ); - } else { - return renderImage(props.short_name || props.name); + } else if (props.renderBanner == true || props.renderBanner == undefined) { + return renderBanner(props.short_name || props.name); + } + else { + return null; } } catch (e) { - return renderImage(props.short_name || props.name); + if (props.renderBanner == true || props.renderBanner == undefined) { + return renderBanner(props.short_name || props.name); + } + else { + return null; + } } })(); @@ -96,7 +105,7 @@ function MagicCard(props: CardProps) { {img}
{props.name}
-

{props.description}

+ {renderDescription(props.description)}
{links}
diff --git a/src/components/Projects.tsx b/src/components/Projects.tsx index 1c5b293..5e00759 100644 --- a/src/components/Projects.tsx +++ b/src/components/Projects.tsx @@ -1,28 +1,10 @@ -import React, { useState, useEffect } from 'react'; -import MagicCard, { CardProps } from './MagicCard'; -import { shuffleFisherYates } from '../Utils'; -import ProjectData from './Projects.json'; -import './Projects.css'; +import CardSection from './CardSection'; +import ProjectData from '../data/Projects.json'; function Projects() { - let [projects, setProjects] = useState([]); - - useEffect(() => { - setProjects(ProjectData); - }, []); - - let _projects = projects.map((project) => { - return (); - }) - - _projects = shuffleFisherYates(_projects as []); - return ( -
-

Projects

-
{_projects}
-
+ ); } diff --git a/src/components/Starter.tsx b/src/components/Starter.tsx index e5cb795..9324446 100644 --- a/src/components/Starter.tsx +++ b/src/components/Starter.tsx @@ -38,7 +38,7 @@ function Starter() {
-
+
more info below
diff --git a/src/components/Team.tsx b/src/components/Team.tsx new file mode 100644 index 0000000..25ba8fd --- /dev/null +++ b/src/components/Team.tsx @@ -0,0 +1,11 @@ +import CardSection from './CardSection'; +import TeamData from '../data/Team.json'; + + +function Team() { + return ( + + ); +} + +export default Team; diff --git a/src/components/Projects.json b/src/data/Projects.json similarity index 100% rename from src/components/Projects.json rename to src/data/Projects.json diff --git a/src/data/Team.json b/src/data/Team.json new file mode 100644 index 0000000..92c5ed3 --- /dev/null +++ b/src/data/Team.json @@ -0,0 +1,38 @@ +[ + { + "name": "AtHeartEngineer", + "description": "Dev", + "links": [ + { + "github": "https://github.com/atheartengineer" + }, + { + "twitter": "https://twitter.com/atheartengineer" + } + ] + }, + { + "name": "Person1", + "description": "Dev", + "links": [ + { + "github": "https://github.com/atheartengineer" + }, + { + "twitter": "https://twitter.com/atheartengineer" + } + ] + }, + { + "name": "Person2", + "description": "Dev", + "links": [ + { + "github": "https://github.com/atheartengineer" + }, + { + "twitter": "https://twitter.com/atheartengineer" + } + ] + } +] \ No newline at end of file diff --git a/src/index.css b/src/index.css index 4eac46a..9eab190 100644 --- a/src/index.css +++ b/src/index.css @@ -25,7 +25,7 @@ } .btn { - color: black; + color: var(--gray); font-weight: 500; margin: 0.25rem; border: 2px solid var(--gray); @@ -52,7 +52,10 @@ } body { - color: black; + color: var(--gray); + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + text-rendering: optimizeLegibility; background: var(--purple); background-attachment: fixed; height: 100vh;