diff --git a/.babelrc b/.babelrc deleted file mode 100644 index f9a34ac..0000000 --- a/.babelrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "plugins": [ - "@loadable/babel-plugin", - ["prismjs", { - "languages": ["css", "html", "javascript", "jsx", "tsx"], - // "theme": "okaidia", - "css": true - }] - ], - "presets": [ - "@babel/preset-env", - "@babel/preset-react" - ] -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index aa7cfbd..35b0cc8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store .netlify -dist +.next node_modules +out package-lock.json tslint.log \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..c998432 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +.netlify +.next +node_modules +out \ No newline at end of file diff --git a/README.md b/README.md index 8fae59a..945d9be 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ A collection of popular layouts and patterns made with CSS: -* πŸŽ‰Zero dependencies -* πŸŽ‰No frameworks -* πŸŽ‰No CSS hacks -* πŸŽ‰Real use cases +* πŸŽ‰ Zero dependencies +* πŸŽ‰ No frameworks +* πŸŽ‰ No CSS hacks +* πŸŽ‰ Real use cases * Good practices (coming soon) * Accessibility Support (coming soon) @@ -27,24 +27,24 @@ By composing them, you can have any possible layout that exists in the real life - Clone the project: -```console -$ git clone https://github.com/phuoc-ng/csslayout +```shell +$ git clone https://github.com/1milligram/csslayout ``` - Install the dependencies: -```console +```shell $ cd csslayout $ npm install ``` - Run it on the local: -```console -$ npm run dev-server +```shell +$ npm run dev ``` -Visit http://localhost:1234 to see it in action. +Visit http://localhost:3000 to see it in action. ## Contributing @@ -52,7 +52,7 @@ PRs are welcomed. If you thing there are any missing useful layouts or patterns, It's important to note that you should run the following command to lint the code: -```console +```shell $ npm run lint ``` @@ -66,23 +66,3 @@ Be my friend on * [Twitter](https://twitter.com/nghuuphuoc) * [dev.to](https://dev.to/phuocng) * [Github](https://github.com/phuoc-ng) - -## Products - -You might be interested in my products: - -_Products_ -* [Blur Page - A browser extension to hide sensitive information on a web page](https://blur.page) -* [Check Browsers Support - A browser extension to check browser compatibility without leaving your tab](https://checkbrowsers.support) -* [Fake Numbers - Generate fake and valid numbers](https://fakenumbers.io) -* [Form Validation - The best validation library for JavaScript](https://formvalidation.io) -* [Intersection Observer Examples - Practical, real world examples of Intersection Observer](https://intersectionobserver.io) -* [React PDF Viewer - A React component to view a PDF document](https://react-pdf-viewer.dev) - -_Resources_ -* [1LOC - Favorite JavaScript utilities in single line of code](https://1loc.dev) -* [CSS Layout - A collection of popular layouts and patterns made with CSS](https://csslayout.io) -* [HTML DOM - How to manage HTML DOM with vanilla JavaScript](https://htmldom.dev) -* [Responsive Design Patterns - A collection of patterns to create a responsive web page](https://responsive.page) -* [Super tiny, quick tips, tricks and best practices of front-end development](https://getfrontend.tips) -* [this VS that - The differences between ___ and ___ in the front-end development](https://thisthat.dev) diff --git a/bin/generateScreenshot.ts b/bin/generateScreenshot.ts index b39e2ef..6311ad9 100644 --- a/bin/generateScreenshot.ts +++ b/bin/generateScreenshot.ts @@ -13,20 +13,20 @@ const main = () => { } const pattern = args[2]; - + (async () => { - const browser = await puppeteer.launch(); - + const browser = await puppeteer.launch(); + const page = await browser.newPage(); - await page.goto(`http://localhost:1234/patterns/${pattern}`); + await page.goto(`http://localhost:3000/${pattern}`); await page.waitForSelector('.demo__live'); const element = await page.$('.demo__live'); await element.screenshot({ - path: `public/assets/patterns/${pattern}.png` + path: `public/assets/patterns/${pattern}.png`, }); await page.close(); - + await browser.close(); })(); }; diff --git a/client/App.tsx b/client/App.tsx deleted file mode 100644 index 11765c4..0000000 --- a/client/App.tsx +++ /dev/null @@ -1,30 +0,0 @@ -/** - * A collection of popular layouts and patterns made with CSS (https://csslayout.io) - * (c) 2019 - 2021 Nguyen Huu Phuoc - */ - -import * as React from 'react'; -import { BrowserRouter as Router, Route, Switch as RouteSwitch } from 'react-router-dom'; - -import './index.css'; - -import ExplorePage from './pages/ExplorePage'; -import HomePage from './pages/HomePage'; -import PatternPage from './pages/PatternPage'; - -const App = () => { - return ( - - - - - } // tslint:disable-line - /> - - - ); -}; - -export default App; diff --git a/client/components/CoverCard.tsx b/client/components/CoverCard.tsx deleted file mode 100644 index 350e12d..0000000 --- a/client/components/CoverCard.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/** - * A collection of popular layouts and patterns made with CSS (https://csslayout.io) - * (c) 2019 - 2021 Nguyen Huu Phuoc - */ - -import * as React from 'react'; -import { Link } from 'react-router-dom'; - -import Pattern from '../constants/Pattern'; -import slug from '../helpers/slug'; -import CoverLoader from '../loaders/CoverLoader'; -import './coverCard.css'; - -interface CoverCardProps { - pattern: Pattern; -} - -const CoverCard: React.FC = ({ pattern }) => { - return ( - - -

- {pattern} -

- - ); -}; - -export default CoverCard; diff --git a/client/components/Heading.tsx b/client/components/Heading.tsx deleted file mode 100644 index f402640..0000000 --- a/client/components/Heading.tsx +++ /dev/null @@ -1,20 +0,0 @@ -/** - * A collection of popular layouts and patterns made with CSS (https://csslayout.io) - * (c) 2019 - 2021 Nguyen Huu Phuoc - */ - -import * as React from 'react'; - -import './heading.css'; - -interface HeadingProps { - title: string; -} - -const Heading: React.FC = ({ title }) => { - return ( -

{title}

- ); -}; - -export default Heading; diff --git a/client/components/Product.tsx b/client/components/Product.tsx deleted file mode 100644 index dcee56b..0000000 --- a/client/components/Product.tsx +++ /dev/null @@ -1,28 +0,0 @@ -/** - * A collection of popular layouts and patterns made with CSS (https://csslayout.io) - * (c) 2019 - 2021 Nguyen Huu Phuoc - */ - -import * as React from 'react'; - -import './product.css'; -import ProductModel from '../constants/ProductModel'; -import slug from '../helpers/slug'; - -interface ProductProps { - product: ProductModel; -} - -const Product: React.FC = ({ product }) => { - return ( - - ); -}; - -export default Product; diff --git a/client/components/RelatedPatterns.tsx b/client/components/RelatedPatterns.tsx deleted file mode 100644 index c403b3f..0000000 --- a/client/components/RelatedPatterns.tsx +++ /dev/null @@ -1,30 +0,0 @@ -/** - * A collection of popular layouts and patterns made with CSS (https://csslayout.io) - * (c) 2019 - 2021 Nguyen Huu Phuoc - */ - -import * as React from 'react'; - -import Pattern from '../constants/Pattern'; -import CoverCard from './CoverCard'; -import Heading from './Heading'; - -interface RelatedPatternsProps { - patterns: Pattern[]; -} - -const RelatedPatterns: React.FC = ({ patterns }) => { - return ( -
- - -
- { - patterns.map((pattern) => ) - } -
-
- ); -}; - -export default RelatedPatterns; diff --git a/client/components/SampleCode.tsx b/client/components/SampleCode.tsx deleted file mode 100644 index cafb366..0000000 --- a/client/components/SampleCode.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/** - * A collection of popular layouts and patterns made with CSS (https://csslayout.io) - * (c) 2019 - 2021 Nguyen Huu Phuoc - */ - -import * as React from 'react'; - -import highlight from '../helpers/highlight'; - -interface SampleCodeProps { - code: string; - fullHeight?: boolean; - lang: string; -} - -const SampleCode: React.FC = ({ code, fullHeight = false, lang }) => { - return code === '' - ? <> - : ( -
-            );
-};
-
-export default SampleCode;
diff --git a/client/components/ad.css b/client/components/ad.css
deleted file mode 100644
index 89b7ee0..0000000
--- a/client/components/ad.css
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-#carbonads {
-    border: 1px solid rgba(0, 0, 0, .3);
-    border-radius: 0.5rem;
-    padding: 0.5rem;
-}
-.carbon-img {
-    display: block;
-    margin-bottom: 0.5rem;
-    text-align: center;
-}
-.carbon-poweredby {
-    display: block;
-    font-size: 0.75rem;
-    text-align: right;
-}
-.carbon-text {
-    display: block;
-}
diff --git a/client/components/heading.css b/client/components/heading.css
deleted file mode 100644
index 11077a6..0000000
--- a/client/components/heading.css
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-.heading {
-    color: var(--color-gray-9);
-    display: grid;
-    font-size: 2rem;
-    grid-template-columns: 1fr auto 1fr;
-    grid-gap: 1rem;
-    text-align: center;
-}
-.heading::before,
-.heading::after {
-    align-self: center;
-    border-top: 0.25rem double var(--color-gray-9);
-    content: '';
-}
diff --git a/client/components/product.css b/client/components/product.css
deleted file mode 100644
index cfcbfde..0000000
--- a/client/components/product.css
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-.product {
-    border-radius: 0.5rem;
-    color: #FFF;
-    margin: 1rem 0;
-    overflow: hidden;
-    padding: 1rem;
-}
-.product a {
-    color: #FFF;
-    text-align: center;
-    text-decoration: none;
-}
-.product__logo {
-    display: flex;
-    height: auto;
-    margin: 0 auto;
-    width: 6rem;
-}
-.product__name {
-    font-size: 1.5rem;
-    margin: 1rem;
-}
-.product__desc {
-    text-align: center;
-}
\ No newline at end of file
diff --git a/client/constants/ProductList.ts b/client/constants/ProductList.ts
deleted file mode 100644
index 0ab51a8..0000000
--- a/client/constants/ProductList.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-import ProductModel from './ProductModel';
-
-const ProductList: ProductModel[] = [
-    {
-        name: 'Intersection Observer Examples',
-        url: 'https://intersectionobserver.io',
-        description: 'Practical, real world examples of Intersection Observer',
-        themeColor: '#024ca9',
-    },
-    {
-        name: 'Blur Page',
-        url: 'https://blur.page',
-        description: 'A browser extension to hide sensitive information on a web page',
-        themeColor: '#4e7fb8',
-    },
-    {
-        name: 'Check Browsers Support',
-        url: 'https://checkbrowsers.support',
-        description: 'A browser extension to check browser compatibility without leaving your tab',
-        themeColor: '#f33446',
-    },
-    {
-        name: 'Form Validation',
-        url: 'https://formvalidation.io',
-        description: 'The best validation library for JavaScript',
-        themeColor: '#014ba6',
-    },
-    {
-        name: 'React PDF Viewer',
-        url: 'https://react-pdf-viewer.dev',
-        description: 'A React component to view a PDF document',
-        themeColor: '#fb6303',
-    },
-    {
-        name: '1 LOC',
-        url: 'https://1loc.dev',
-        description: 'Favorite JavaScript utilities in single line of code',
-        themeColor: '#000200',
-    },
-    {
-        name: 'Front-end Tips',
-        url: 'https://getfrontend.tips',
-        description: 'Super tiny, quick tips, tricks and best practices of front-end development',
-        themeColor: '#2e2c74',
-    },
-    {
-        name: 'HTML DOM',
-        url: 'https://htmldom.dev',
-        description: 'How to manage HTML DOM with vanilla JavaScript',
-        themeColor: '#5b5d8a',
-    },
-    {
-        name: 'Responsive Design Patterns',
-        url: 'https://responsive.page',
-        description: 'A collection of patterns to create a responsive web page',
-        themeColor: '#43246d',
-    },
-    {
-        name: 'this VS that',
-        url: 'https://thisthat.dev',
-        description: 'The differences between _ and _ in the front-end development',
-        themeColor: '#414293',
-    },
-];
-
-export { ProductList };
diff --git a/client/constants/ProductModel.ts b/client/constants/ProductModel.ts
deleted file mode 100644
index fbb1b99..0000000
--- a/client/constants/ProductModel.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-export default interface ProductModel {
-    name: string;
-    url: string;
-    description: string;
-    themeColor: string;
-}
diff --git a/client/helpers/chunk.ts b/client/helpers/chunk.ts
deleted file mode 100644
index e90cfd5..0000000
--- a/client/helpers/chunk.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-function chunk(arr: T[], size: number): T[][] {
-    return arr.reduce((acc, e, i) => (i % size ? acc[acc.length - 1].push(e) : acc.push([e]), acc), []);
-};
-
-export default chunk;
diff --git a/client/helpers/highlight.ts b/client/helpers/highlight.ts
deleted file mode 100755
index abd0271..0000000
--- a/client/helpers/highlight.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-import Prism from 'prismjs';
-
-const highlight = (input: string, language: string) => {
-    const lang = language || 'html';
-    const value = Prism.highlight(input, Prism.languages[language], language);
-    const highlighted = value.replace('&', '&').trim();
-
-    return `${highlighted}`;
-};
-
-export default highlight;
\ No newline at end of file
diff --git a/client/helpers/random.ts b/client/helpers/random.ts
deleted file mode 100644
index d1ca7fe..0000000
--- a/client/helpers/random.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-const random = (min: number, max: number) => min + Math.round(Math.random() * (max - min));
-
-export default random;
diff --git a/client/helpers/randomFromArray.ts b/client/helpers/randomFromArray.ts
deleted file mode 100644
index af9da8c..0000000
--- a/client/helpers/randomFromArray.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-function randomFromArray(array: T[]): T {
-    return array[Math.floor(Math.random() * array.length)];
-};
-
-export default randomFromArray;
diff --git a/client/helpers/randomIterms.ts b/client/helpers/randomIterms.ts
deleted file mode 100644
index c0a4813..0000000
--- a/client/helpers/randomIterms.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-type Tuple = [number, T[]];
-
-function randomItems(arr: T[], count: number): T[] {
-    const result = arr.concat().reduce(
-        (p, _, __, arr) => {
-            const [a, b] = p;
-            return (a < count)
-                    ? [a + 1, b.concat(arr.splice(Math.random() * arr.length | 0, 1))]
-                    : p;
-        },
-        [0, []] as Tuple
-    );
-    return (result as Tuple)[1];
-};
-
-export default randomItems;
diff --git a/client/helpers/shuffe.ts b/client/helpers/shuffe.ts
deleted file mode 100644
index eb53299..0000000
--- a/client/helpers/shuffe.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-const shuffe = (array: number[]) => {
-    array.sort(() => Math.random() - 0.5);
-    return array;
-};
-
-export default shuffe;
diff --git a/client/helpers/slug.ts b/client/helpers/slug.ts
deleted file mode 100644
index 41fb445..0000000
--- a/client/helpers/slug.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-const slug = (item: string) => item.toLowerCase().split(' ').join('-');
-
-export default slug;
diff --git a/client/hooks/useInterval.ts b/client/hooks/useInterval.ts
deleted file mode 100644
index 7848f28..0000000
--- a/client/hooks/useInterval.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-import { useEffect } from 'react';
-
-const useInterval = (callback: () => void, delay?: number) => {
-    useEffect(
-        () => {
-            const handler = () => callback();
-            if (delay !== null) {
-                const id = setInterval(handler, delay);
-                return () => clearInterval(id);
-            }
-        },
-        [delay],
-    );
-};
-
-export default useInterval;
diff --git a/client/index.css b/client/index.css
deleted file mode 100644
index 942a095..0000000
--- a/client/index.css
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * A collection of popular layouts and patterns made with CSS (https://csslayout.io)
- * (c) 2019 - 2021 Nguyen Huu Phuoc 
- */
-
-:root {
-    --background-color: #e7d900;
-    --color-blue-6: #2563EB;
-    --color-gray-2: #E5E7EB;
-    --color-gray-5: #6B7280;
-    --color-gray-8: #27272A;
-    --color-gray-9: #111827;
-} 
-body {
-    font-family: Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
-    margin: 0;
-}
-* {
-    box-sizing: border-box;
-}
-a {
-    text-decoration: none;
-}
-
-::-webkit-scrollbar {
-    height: 0.5rem;
-    width: 0.5rem;
-}
-::-webkit-scrollbar-thumb {
-    background-color: var(--color-gray-5);
-    border-radius: 0.5rem;
-}
-::-webkit-scrollbar-track {
-    background-color: transparent;
-    border-radius: 0.5rem;
-}
-
-/* Layout */
-.container {
-    margin: 0 auto;
-    max-width: 80rem;
-    padding: 0 1rem;
-}
-.main {
-    flex: 1;
-    overflow: hidden;
-    padding: 4rem 0;
-}
-.sidebar {
-    display: none;
-    padding: 4rem 0;
-}
-
-/* Sidebar */
-.sidebar__inner {    
-    position: sticky;
-    top: 1rem;
-}
-
-/* Hero */
-.hero {
-    --current-background-color: var(--background-color);
-    background: var(--background-color);
-    display: flex;
-    justify-content: center;
-    padding-bottom: 1rem;
-}
-.hero__logo {
-    display: flex;
-    justify-content: center;
-}
-.hero__logo img {
-    object-fit: cover;
-    width: 16rem;
-}
-.hero__heading {
-    color: var(--color-gray-9);
-    font-size: 2rem;
-    line-height: 1.5;
-    text-align: center;
-    text-transform: uppercase;
-}
-.hero__subheading {
-    color: var(--color-gray-9);
-    font-size: 1.5rem;
-    line-height: 1.5;
-    text-align: center;
-}
-
-/*
-Prism theme
-Credit to https://github.com/tailwindlabs/tailwindcss.com/blob/master/src/css/prism.css
-*/
-pre {
-    background: var(--color-gray-8);
-    border: none;
-    border-radius: 0px;
-    box-shadow: none;
-    color: #FFF;
-    font-family: "Source Code Pro", monospace;
-    font-size: 1rem;
-    line-height: 1.5;
-    margin: 0px;
-    overflow-x: auto;
-    padding: 1rem;
-    white-space: pre;
-}
-
-.token.tag,
-.token.class-name,
-.token.selector,
-.token.selector .class,
-.token.function {
-    color: #E879F9;
-}
-
-.token.attr-name,
-.token.keyword,
-.token.rule,
-.token.operator,
-.token.pseudo-class,
-.token.important {
-    color: #22D3EE;
-}
-
-.token.attr-value,
-.token.class,
-.token.string,
-.token.number,
-.token.unit,
-.token.color {
-    color: #BEF264;
-}
-
-.token.punctuation,
-.token.module,
-.token.property {
-    color: #BAE6FD;
-}
-
-.token.atapply .token:not(.rule):not(.important) {
-    color: inherit;
-}
-
-.language-shell .token:not(.comment) {
-    color: inherit;
-}
-
-.language-css .token.function {
-    color: inherit;
-}
-
-.token.comment {
-    color: #A1A1AA;
-}
-
-/* Responsive */
-@media (min-width: 640px) {
-    .content {
-        display: flex;
-    }
-    .sidebar {
-        display: block;
-        flex: 0 0 8rem;
-        margin-left: 0.5rem;
-    }
-}
-@media (min-width: 768px) {
-    .sidebar {
-        flex-basis: 12rem;
-        margin-left: 1rem;
-    }
-}
-@media (min-width: 1024px) {
-    .sidebar {
-        flex-basis: 16rem;
-        margin-left: 2rem;
-    }
-}
\ No newline at end of file
diff --git a/client/index.html b/client/index.html
deleted file mode 100644
index 40fad5e..0000000
--- a/client/index.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-
-
-    
- - - - \ No newline at end of file diff --git a/client/index.tsx b/client/index.tsx deleted file mode 100644 index 003af80..0000000 --- a/client/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -/** - * A collection of popular layouts and patterns made with CSS (https://csslayout.io) - * (c) 2019 - 2021 Nguyen Huu Phuoc - */ - -import * as React from 'react'; -import { hydrate, render } from 'react-dom'; - -import App from './App'; - -const rootElement = document.getElementById('root'); -rootElement.hasChildNodes() - ? hydrate(, rootElement) - : render(, rootElement); diff --git a/client/layouts/DetailsLayout.tsx b/client/layouts/DetailsLayout.tsx deleted file mode 100644 index 3c50e9f..0000000 --- a/client/layouts/DetailsLayout.tsx +++ /dev/null @@ -1,67 +0,0 @@ -/** - * A collection of popular layouts and patterns made with CSS (https://csslayout.io) - * (c) 2019 - 2021 Nguyen Huu Phuoc - */ - -import * as React from 'react'; -import { Helmet } from 'react-helmet'; - -import Ad from '../components/Ad'; -import Product from '../components/Product'; -import { ProductList } from '../constants/ProductList'; -import Pattern from '../constants/Pattern'; -import randomItems from '../helpers/randomIterms'; -import slug from '../helpers/slug'; -import CoverLoader from '../loaders/CoverLoader'; -import Layout from './Layout'; - -interface DetailsLayoutProps { - pattern: Pattern; -} - -const DetailsLayout: React.FC = ({ pattern, children }) => { - const products = React.useMemo(() => randomItems(ProductList, 3), []); - const patternSlug = slug(pattern); - - return ( - - - CSS Layout βˆ™ {pattern} - - - - - - - - - - -
-
-
- -
-

{pattern}

-
-
-
-
-
- {children} -
-
-
- - { - products.map(product => ) - } -
-
-
-
-
- ); -}; - -export default DetailsLayout; diff --git a/client/layouts/Footer.tsx b/client/layouts/Footer.tsx deleted file mode 100644 index 768833e..0000000 --- a/client/layouts/Footer.tsx +++ /dev/null @@ -1,86 +0,0 @@ -/** - * A collection of popular layouts and patterns made with CSS (https://csslayout.io) - * (c) 2019 - 2021 Nguyen Huu Phuoc - */ - -import * as React from 'react'; - -import './footer.css'; - -const Footer: React.FC<{}> = () => { - return ( - - ); -}; - -export default Footer; diff --git a/client/layouts/Header.tsx b/client/layouts/Header.tsx deleted file mode 100644 index 98c10f9..0000000 --- a/client/layouts/Header.tsx +++ /dev/null @@ -1,43 +0,0 @@ -/** - * A collection of popular layouts and patterns made with CSS (https://csslayout.io) - * (c) 2019 - 2021 Nguyen Huu Phuoc - */ - -import * as React from 'react'; -import { Link } from 'react-router-dom'; - -import './header.css'; - -const STARS_KEY = 'stars'; - -const Header: React.FC<{}> = () => { - const stars = window.localStorage.getItem(STARS_KEY) || ''; - const [totalStars, setTotalStars] = React.useState(stars); - - React.useEffect(() => { - if (window.location.pathname === '/' || stars === '') { - fetch('https://api.github.com/repos/phuoc-ng/csslayout') - .then(res => res.json()) - .then(data => setTotalStars(data.stargazers_count)) - .catch(console.log); - } - }, []); - - React.useEffect(() => window.localStorage.setItem(STARS_KEY, totalStars), [totalStars]); - - return ( -
-
-
- - - - Patterns - {totalStars}β˜… -
-
-
- ); -}; - -export default Header; diff --git a/client/layouts/Layout.tsx b/client/layouts/Layout.tsx deleted file mode 100644 index 0633eb8..0000000 --- a/client/layouts/Layout.tsx +++ /dev/null @@ -1,25 +0,0 @@ -/** - * A collection of popular layouts and patterns made with CSS (https://csslayout.io) - * (c) 2019 - 2021 Nguyen Huu Phuoc - */ - -import * as React from 'react'; - -import Footer from './Footer'; -import Header from './Header'; - -const Layout: React.FC<{}> = ({ children }) => { - React.useEffect(() => { - window.scrollTo(0, 0); - }, []); - - return ( - <> -
- {children} -