From 7dc6186777434e9d53d2c094d25cbf839ab7e925 Mon Sep 17 00:00:00 2001 From: Phuoc Nguyen Date: Sat, 30 Nov 2019 16:46:30 +0700 Subject: [PATCH] Add overlay play button --- client/constants/Pattern.ts | 1 + client/pages/ExplorePage.tsx | 1 + client/patterns/overlay-play-button/Cover.tsx | 58 +++++++++++ .../patterns/overlay-play-button/Details.tsx | 98 +++++++++++++++++++ client/placeholders/Triangle.tsx | 29 ++++-- public/sitemap.xml | 1 + 6 files changed, 181 insertions(+), 7 deletions(-) create mode 100644 client/patterns/overlay-play-button/Cover.tsx create mode 100644 client/patterns/overlay-play-button/Details.tsx diff --git a/client/constants/Pattern.ts b/client/constants/Pattern.ts index ebf74a9..9c3be3e 100644 --- a/client/constants/Pattern.ts +++ b/client/constants/Pattern.ts @@ -21,6 +21,7 @@ enum Pattern { Menu = 'Menu', Modal = 'Modal', Notification = 'Notification', + OverlayPlayButton = 'Overlay play button', Pagination = 'Pagination', PresenceIndicator = 'Presence indicator', PreviousNextButtons = 'Previous next buttons', diff --git a/client/pages/ExplorePage.tsx b/client/pages/ExplorePage.tsx index 178ab28..8e178be 100644 --- a/client/pages/ExplorePage.tsx +++ b/client/pages/ExplorePage.tsx @@ -104,6 +104,7 @@ const ExplorePage = () => { + diff --git a/client/patterns/overlay-play-button/Cover.tsx b/client/patterns/overlay-play-button/Cover.tsx new file mode 100644 index 0000000..42ee316 --- /dev/null +++ b/client/patterns/overlay-play-button/Cover.tsx @@ -0,0 +1,58 @@ +import React from 'react'; + +import Frame from '../../placeholders/Frame'; +import Triangle from '../../placeholders/Triangle'; + +const Cover: React.FC<{}> = () => { + return ( + +
+
+
+
+ +
+
+
+
+ + ); +}; + +export default Cover; diff --git a/client/patterns/overlay-play-button/Details.tsx b/client/patterns/overlay-play-button/Details.tsx new file mode 100644 index 0000000..3ca49a7 --- /dev/null +++ b/client/patterns/overlay-play-button/Details.tsx @@ -0,0 +1,98 @@ +import React from 'react'; + +import DetailsLayout from '../../layouts/DetailsLayout'; +import BrowserFrame from '../../placeholders/BrowserFrame'; +import Triangle from '../../placeholders/Triangle'; + +const Details: React.FC<{}> = () => { + return ( + +
+ +
+
+
+ +
+
+
+
+ )} + source={` +
+ +
+`} + /> + +
+ ); +}; + +export default Details; diff --git a/client/placeholders/Triangle.tsx b/client/placeholders/Triangle.tsx index 2d71136..ef2a0b3 100644 --- a/client/placeholders/Triangle.tsx +++ b/client/placeholders/Triangle.tsx @@ -1,43 +1,58 @@ import React from 'react'; interface TriangleProps { + backgroundColor?: string; corner?: string; size?: number; } -const Triangle: React.FC = ({ size = 16, corner = 'tl' }) => { +const Triangle: React.FC = ({ + backgroundColor = 'rgba(0, 0, 0, .3)', + size = 16, + corner = 'tl', +}) => { let bw = ''; let bc = ''; switch (corner) { case 't': bw = `0 ${size}px ${size}px ${size}px`; - bc = 'transparent transparent rgba(0, 0, 0, .3) transparent'; + bc = `transparent transparent ${backgroundColor} transparent`; + break; + + case 'r': + bw = `${size}px 0 ${size}px ${2 * size}px`; + bc = `transparent transparent transparent ${backgroundColor}`; break; case 'b': bw = `${size}px ${size}px 0 ${size}px`; - bc = 'rgba(0, 0, 0, .3) transparent transparent transparent'; + bc = `${backgroundColor} transparent transparent transparent`; + break; + + case 'l': + bw = `${size}px ${2 * size}px ${size}px 0`; + bc = `transparent ${backgroundColor} transparent transparent`; break; case 'tr': bw = `0 ${size}px ${size}px 0`; - bc = 'transparent rgba(0, 0, 0, .3) transparent transparent'; + bc = `transparent ${backgroundColor} transparent transparent`; break; case 'br': bw = `0 0 ${size}px ${size}px`; - bc = 'transparent transparent rgba(0, 0, 0, .3) transparent'; + bc = `transparent transparent ${backgroundColor} transparent`; break; case 'bl': bw = `${size}px 0 0 ${size}px`; - bc = 'transparent transparent transparent rgba(0, 0, 0, .3)'; + bc = `transparent transparent transparent ${backgroundColor}`; break; case 'tl': default: bw = `${size}px ${size}px 0 0`; - bc = 'rgba(0, 0, 0, .3) transparent transparent transparent'; + bc = `${backgroundColor} transparent transparent transparent`; break; } diff --git a/public/sitemap.xml b/public/sitemap.xml index 15bc30c..719a0c8 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -26,6 +26,7 @@ https://csslayout.io/patterns/menu https://csslayout.io/patterns/modal https://csslayout.io/patterns/notification + https://csslayout.io/patterns/overlay-play-button https://csslayout.io/patterns/pagination https://csslayout.io/patterns/presence-indicator https://csslayout.io/patterns/previous-next-buttons