Skip to content

Commit

Permalink
style: eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchLui committed Nov 7, 2023
1 parent 48f4f2d commit dd16ce8
Show file tree
Hide file tree
Showing 29 changed files with 331 additions and 403 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
],
"rules": {
"semi": ["error", "always"],
"quotes": ["error", "single"]
"quotes": ["error", "single"],
"indent": ["error", 2]
}
}
36 changes: 17 additions & 19 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,30 @@ import { ProjectsPage } from './pages/ProjectPage/ProjectsPage';
import { ProjectModalPage } from './pages/ProjectModalPage/ProjectModalPage';
import { Derrianne } from './pages/Derrianne/Derrianne';
import { NotFoundPage } from './pages/NotFoundPage/NotFoundPage';
import { Copyright } from './components/Copyright/Copyright';
import { SitemapPage } from './pages/SitemapPage/SitemapPage';
import { RedirectPage } from './pages/RedirectPage/RedirectPage';

import './App.scss';

function App (): React.ReactElement {
return (
<div className={'App'}>
<Router>
<NavBar/>
<Routes>
<Route path={'/'} element={<HomePage/>}/>
<Route path={'/derrianne'} element={<Derrianne/>}/>
<Route path={'/projects'} element={<ProjectsPage/>}/>
<Route path={'/projects/:projectClass'} element={<ProjectModalPage/>}/>
<Route path={'/sitemap'} element={<SitemapPage/>}/>
<Route path={'/not-found'} element={<NotFoundPage/>}/>
<Route path={'/linkedin'} element={<RedirectPage redirect={'https://linkedin.com/in/mitchlui'}/>}/>
<Route path={'/github'} element={<RedirectPage redirect={'https://github.com/mitchlui'}/>}/>
<Route path={'/medium'} element={<RedirectPage redirect={'https://mitchlui.medium.com'}/>}/>
<Route path={'*'} element={<NotFoundPage/>}/>
</Routes>
<Copyright/>
</Router>
</div>
<div className={'App'}>
<Router>
<NavBar/>
<Routes>
<Route path={'/'} element={<HomePage/>}/>
<Route path={'/derrianne'} element={<Derrianne/>}/>
<Route path={'/projects'} element={<ProjectsPage/>}/>
<Route path={'/projects/:projectClass'} element={<ProjectModalPage/>}/>
<Route path={'/sitemap'} element={<SitemapPage/>}/>
<Route path={'/not-found'} element={<NotFoundPage/>}/>
<Route path={'/linkedin'} element={<RedirectPage redirect={'https://linkedin.com/in/mitchlui'}/>}/>
<Route path={'/github'} element={<RedirectPage redirect={'https://github.com/mitchlui'}/>}/>
<Route path={'/medium'} element={<RedirectPage redirect={'https://mitchlui.medium.com'}/>}/>
<Route path={'*'} element={<NotFoundPage/>}/>
</Routes>
</Router>
</div>
);
}

Expand Down
9 changes: 4 additions & 5 deletions src/components/Arrow/Arrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ type ArrowProps = {
text: string;
}

// eslint-disable-next-line no-undef
export const Arrow = ({ text }: ArrowProps): React.ReactElement =>
<div className={'arrow-container'}>
<div className={'arrow'}/>
<span className={'arrow-text'}>{text}</span>
</div>;
<div className={'arrow-container'}>
<div className={'arrow'}/>
<span className={'arrow-text'}>{text}</span>
</div>;
26 changes: 13 additions & 13 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,30 @@ type LinkButtonProps = CommonButtonProps & {
}

export const LinkButton = ({ to, text }: LinkButtonProps): React.ReactElement =>
<Link to={to} className={'button'}>{text}</Link>;
<Link to={to} className={'button'}>{text}</Link>;

type FunctionButtonProps = CommonButtonProps & {
onClick: () => void;
}

export const FunctionButton = ({ onClick, text }: FunctionButtonProps): React.ReactElement =>
<button className={'button'} onClick={onClick}>{text}</button>;
<button className={'button'} onClick={onClick}>{text}</button>;

type LinkFunctionButtonProps = CommonButtonProps & LinkButtonProps & FunctionButtonProps;

export const LinkFunctionButton = ({ to, text, onClick }: LinkFunctionButtonProps): React.ReactElement =>
<Link onClick={onClick} to={to} className={'button'}>{text}</Link>;
<Link onClick={onClick} to={to} className={'button'}>{text}</Link>;

type ModalCloseButtonProps = {
onClick: () => void;
to: string;
}

export const ModalCloseButton = ({ onClick, to }: ModalCloseButtonProps): React.ReactElement =>
<Link onClick={onClick} to={to} className={'modal'}><Cross/></Link>;
<Link onClick={onClick} to={to} className={'modal'}><Cross/></Link>;

export const GoBackButton = ({ to, text }: LinkButtonProps): React.ReactElement =>
<Link to={to} className={'modal'}><Arrow text={text}/></Link>;
<Link to={to} className={'modal'}><Arrow text={text}/></Link>;

type ContactButtonProps = CommonButtonProps & {
icon: string;
Expand All @@ -58,11 +58,11 @@ type ContactButtonProps = CommonButtonProps & {
}

export const ContactButton = ({ icon, href, alt, text }: ContactButtonProps): React.ReactElement =>
<a className={'button contact'} href={href} target={'_blank'} rel={'noreferrer'}>
<div className={'contact-icon'}>
<img src={icon} alt={alt}/>
</div>
<div className={'contact-text'}>
{text}
</div>
</a>;
<a className={'button contact'} href={href} target={'_blank'} rel={'noreferrer'}>
<div className={'contact-icon'}>
<img src={icon} alt={alt}/>
</div>
<div className={'contact-text'}>
{text}
</div>
</a>;
34 changes: 17 additions & 17 deletions src/components/Cards/Cards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ type CardProps = {
}

export const ProjectCard = ({ key, name, title, thumbnail, alt, headline, gitUrl }: CardProps): React.ReactElement =>
<article key={key} className={'card project ' + name}>
<picture className={'thumbnail'}>
<source srcSet={'/project_assets/webp/' + thumbnail + '.webp'} type="image/webp" />
<img
src={'/project_assets/png/' + thumbnail + '.png'}
alt={alt}
/>
</picture>
<h2>{title}</h2>
<div className={'card-content'}>{headline}</div>
<footer>
<LinkButton to={'/projects/' + name} text={'Learn more'}/>
{
gitUrl &&
<article key={key} className={'card project ' + name}>
<picture className={'thumbnail'}>
<source srcSet={'/project_assets/webp/' + thumbnail + '.webp'} type="image/webp" />
<img
src={'/project_assets/png/' + thumbnail + '.png'}
alt={alt}
/>
</picture>
<h2>{title}</h2>
<div className={'card-content'}>{headline}</div>
<footer>
<LinkButton to={'/projects/' + name} text={'Learn more'}/>
{
gitUrl &&
<Button url={gitUrl} target={'_blank'} text={'Code'}/>
}
</footer>
</article>;
}
</footer>
</article>;
76 changes: 33 additions & 43 deletions src/components/Contact/Contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,41 @@ import { ContactButton } from '../Button/Button';
import EmailSVG from './contact_images/email.svg';
import LinkedInSVG from './contact_images/linkedin.svg';
import GitHubSVG from './contact_images/github.svg';
import TwitterSVG from './contact_images/twitter.svg';
import React from 'react';
import './contact.scss';

export const Contact = (): React.ReactElement =>
<section className={'contact-container'}>
<div className={'contact-header-text'}>
<section className={'contact-container'}>
<div className={'contact-header-text'}>
Contact me:
</div>
<div className={'current-status'} />
<div className={'contact-links'}>
<ul>
<li>
<ContactButton
icon={EmailSVG}
href={'mailto:[email protected]'}
alt={'email contact icon'}
text={'Email'}
/>
</li>
<li>
<ContactButton
icon={LinkedInSVG}
href={'https://www.linkedin.com/in/mitchlui/'}
alt={'linkedin contact icon'}
text={'Linkedin'}
/>
</li>
<li>
<ContactButton
icon={GitHubSVG}
href={'https://www.github.com/mitchlui'}
alt={'github contact icon'}
text={'GitHub'}
/>
</li>
<li>
<ContactButton
icon={TwitterSVG}
href={'https://www.twitter.com/mitchluidev'}
alt={'twitter contact icon'}
text={'Twitter'}
/>
</li>
</ul>

</div>
</section>;
</div>
<div className={'current-status'} />
<div className={'contact-links'}>
<ul>
<li>
<ContactButton
icon={EmailSVG}
href={'mailto:[email protected]'}
alt={'email contact icon'}
text={'Email'}
/>
</li>
<li>
<ContactButton
icon={LinkedInSVG}
href={'https://www.linkedin.com/in/mitchlui/'}
alt={'linkedin contact icon'}
text={'Linkedin'}
/>
</li>
<li>
<ContactButton
icon={GitHubSVG}
href={'https://www.github.com/mitchlui'}
alt={'github contact icon'}
text={'GitHub'}
/>
</li>
</ul>
</div>
</section>;
8 changes: 0 additions & 8 deletions src/components/Contact/contact_images/twitter.svg

This file was deleted.

3 changes: 2 additions & 1 deletion src/components/Container/Container.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import './container.scss';
import { Copyright } from '../Copyright/Copyright';

type ContainerProps = {
children: React.ReactNode;
}

export const Container = ({ children }: ContainerProps): React.ReactElement =>
<div><div className="container">{children}</div></div>;
<div className="container">{children}<Copyright/></div>;
1 change: 1 addition & 0 deletions src/components/Container/container.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.container {
display: block;
padding-left: 10%;
padding-right: 10%;
padding-bottom: 2.5%;
Expand Down
6 changes: 3 additions & 3 deletions src/components/Copyright/Copyright.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function getCurrentYear (): number {
}

export const Copyright = (): React.ReactElement =>
<section className={'copyright'}>
<section className={'copyright'}>
Copyright © {getCurrentYear()} Mitch Lui. All rights reserved.
<p><Link to={'/sitemap'}>Sitemap</Link></p>
</section>;
<p><Link to={'/sitemap'}>Sitemap</Link></p>
</section>;
6 changes: 1 addition & 5 deletions src/components/Copyright/copyright.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
.copyright{
padding: 2rem 0.5rem;
position: relative;
left: 0px;
right: 0px;
bottom: 2rem;
text-align: center;
font-size: 0.75rem;
opacity: 75%;
text-align: center;
}

2 changes: 1 addition & 1 deletion src/components/Cross/Cross.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import React from 'react';
import './cross.scss';

export const Cross = (): React.ReactElement =>
<div className={'modal-close'}/>;
<div className={'modal-close'}/>;
24 changes: 12 additions & 12 deletions src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ type DropdownProps = {
}

export const Dropdown = ({ className, onChange, label, options }: DropdownProps): React.ReactElement =>
<>
<label className={'dropdown-label'} htmlFor={className}>{label}</label>
<select className={'dropdown-menu'} onChange={(e) => onChange(e.target.value)} name={'Sort by:'} id={className} defaultValue={'none'}>
{Object.keys(options).map((key) =>
<optgroup key={key} label={key}>
{options[key].map((option) =>
<option key={option.value} value={option.value}>{option.text}</option>
)}
</optgroup>
)}
</select>
</>;
<>
<label className={'dropdown-label'} htmlFor={className}>{label}</label>
<select className={'dropdown-menu'} onChange={(e) => onChange(e.target.value)} name={'Sort by:'} id={className} defaultValue={'none'}>
{Object.keys(options).map((key) =>
<optgroup key={key} label={key}>
{options[key].map((option) =>
<option key={option.value} value={option.value}>{option.text}</option>
)}
</optgroup>
)}
</select>
</>;
31 changes: 0 additions & 31 deletions src/components/FadeInSection/FadeInSection.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions src/components/FadeInSection/fadeinsection.scss

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/Grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ type GridProps = {

export const Grid = ({ children }: GridProps): React.ReactElement => {
return (
<div className={'grid'}>
{children}
</div>
<div className={'grid'}>
{children}
</div>
);
};
Loading

0 comments on commit dd16ce8

Please sign in to comment.