From e8b09d8a1454c5d1b470094660471c101ce0e9ad Mon Sep 17 00:00:00 2001 From: Phuoc Nguyen Date: Thu, 26 Dec 2019 21:23:46 +0700 Subject: [PATCH] Add sticky table headers --- client/constants/Pattern.ts | 1 + client/pages/ExplorePage.tsx | 1 + client/patterns/sticky-header/Details.tsx | 6 +- .../patterns/sticky-table-headers/Cover.tsx | 65 +++++++++ .../patterns/sticky-table-headers/Details.tsx | 126 ++++++++++++++++++ public/sitemap.xml | 1 + 6 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 client/patterns/sticky-table-headers/Cover.tsx create mode 100644 client/patterns/sticky-table-headers/Details.tsx diff --git a/client/constants/Pattern.ts b/client/constants/Pattern.ts index e1e27e5..2cf8d5f 100644 --- a/client/constants/Pattern.ts +++ b/client/constants/Pattern.ts @@ -66,6 +66,7 @@ enum Pattern { StickyFooter = 'Sticky footer', StickyHeader = 'Sticky header', StickySections = 'Sticky sections', + StickyTableHeaders = 'Sticky table headers', Switch = 'Switch', Tab = 'Tab', Timeline = 'Timeline', diff --git a/client/pages/ExplorePage.tsx b/client/pages/ExplorePage.tsx index 1496eb9..a3ad273 100644 --- a/client/pages/ExplorePage.tsx +++ b/client/pages/ExplorePage.tsx @@ -168,6 +168,7 @@ const ExplorePage = () => { + diff --git a/client/patterns/sticky-header/Details.tsx b/client/patterns/sticky-header/Details.tsx index 7605eaa..8266d5e 100644 --- a/client/patterns/sticky-header/Details.tsx +++ b/client/patterns/sticky-header/Details.tsx @@ -1,6 +1,8 @@ import React from 'react'; import { Helmet } from 'react-helmet'; +import RelatedPatterns from '../../components/RelatedPatterns'; +import Pattern from '../../constants/Pattern'; import DetailsLayout from '../../layouts/DetailsLayout'; import Block from '../../placeholders/Block'; import BrowserFrame from '../../placeholders/BrowserFrame'; @@ -11,7 +13,7 @@ const Details: React.FC<{}> = () => { - +
@@ -53,6 +55,8 @@ const Details: React.FC<{}> = () => { `} />
+ + ); }; diff --git a/client/patterns/sticky-table-headers/Cover.tsx b/client/patterns/sticky-table-headers/Cover.tsx new file mode 100644 index 0000000..00c0c9b --- /dev/null +++ b/client/patterns/sticky-table-headers/Cover.tsx @@ -0,0 +1,65 @@ +import React from 'react'; + +import Frame from '../../placeholders/Frame'; +import Line from '../../placeholders/Line'; +import Rectangle from '../../placeholders/Rectangle'; + +const Cover: React.FC<{}> = () => { + return ( + +
+ + + + { + Array(3).fill(0).map((_, index) => { + return ( + + ); + }) + } + + + + { + Array(3).fill(0).map((_, row) => { + return ( + + { + Array(3).fill(0).map((__, col) => { + return ( + + ); + }) + } + + ); + }) + } + +
+ +
+ +
+
+ + ); +}; + +export default Cover; diff --git a/client/patterns/sticky-table-headers/Details.tsx b/client/patterns/sticky-table-headers/Details.tsx new file mode 100644 index 0000000..c13ef25 --- /dev/null +++ b/client/patterns/sticky-table-headers/Details.tsx @@ -0,0 +1,126 @@ +import React from 'react'; +import { Helmet } from 'react-helmet'; + +import RelatedPatterns from '../../components/RelatedPatterns'; +import Pattern from '../../constants/Pattern'; +import DetailsLayout from '../../layouts/DetailsLayout'; +import Block from '../../placeholders/Block'; +import BrowserFrame from '../../placeholders/BrowserFrame'; +import Rectangle from '../../placeholders/Rectangle'; + +const Details: React.FC<{}> = () => { + return ( + + + + + +
+
+ Try to scroll the main content of table to see the header sticks to the top. +
+ +
+ + + + { + Array(3).fill(0).map((_, index) => { + return ( + + ); + }) + } + + + + { + Array(10).fill(0).map((_, row) => { + return ( + + { + Array(3).fill(0).map((__, col) => { + return ( + + ); + }) + } + + ); + }) + } + +
+ +
+ +
+
+
+ )} + source={` + + + + + + + + + + +
+ ... +
+`} + /> +
+ + +
+ ); +}; + +export default Details; diff --git a/public/sitemap.xml b/public/sitemap.xml index 0ce492d..dd05075 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -67,6 +67,7 @@ https://csslayout.io/patterns/sticky-footer https://csslayout.io/patterns/sticky-header https://csslayout.io/patterns/sticky-sections + https://csslayout.io/patterns/sticky-table-headers https://csslayout.io/patterns/switch https://csslayout.io/patterns/tab https://csslayout.io/patterns/timeline