From ca8b2a3c4231398bf4099068bd0062c58fbfe775 Mon Sep 17 00:00:00 2001 From: Phuoc Nguyen Date: Sun, 17 Nov 2019 12:32:18 +0700 Subject: [PATCH 1/2] Add triangle placeholder --- client/placeholders/Triangle.jsx | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 client/placeholders/Triangle.jsx diff --git a/client/placeholders/Triangle.jsx b/client/placeholders/Triangle.jsx new file mode 100644 index 0000000..2ec78aa --- /dev/null +++ b/client/placeholders/Triangle.jsx @@ -0,0 +1,42 @@ +import React from 'react'; + +const Triangle = ({ size = 16, corner = 'tl' }) => { + let bw = ''; + let bc = ''; + switch (corner) { + case 'tr': + bw = `0 ${size}px ${size}px 0`; + bc = 'transparent rgba(0, 0, 0, .3) transparent transparent'; + break; + + case 'br': + bw = `0 0 ${size}px ${size}px`; + bc = 'transparent transparent rgba(0, 0, 0, .3) transparent'; + break; + + case 'bl': + bw = `${size}px 0 0 ${size}px`; + bc = 'transparent transparent transparent rgba(0, 0, 0, .3)'; + break; + + case 'tl': + default: + bw = `${size}px ${size}px 0 0`; + bc = 'rgba(0, 0, 0, .3) transparent transparent transparent'; + break; + } + + return ( +
+ ); +}; + +export default Triangle; From 7ec973cb95a65368ed222241574f4f9468bdf3ae Mon Sep 17 00:00:00 2001 From: Phuoc Nguyen Date: Sun, 17 Nov 2019 12:49:40 +0700 Subject: [PATCH 2/2] Add fixed at corner --- client/App.jsx | 2 + client/Home.jsx | 7 ++ client/layouts/fixed-at-corner/Cover.jsx | 18 +++++ client/layouts/fixed-at-corner/Details.jsx | 83 ++++++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 client/layouts/fixed-at-corner/Cover.jsx create mode 100644 client/layouts/fixed-at-corner/Details.jsx diff --git a/client/App.jsx b/client/App.jsx index 50d48f1..1c92236 100644 --- a/client/App.jsx +++ b/client/App.jsx @@ -5,6 +5,7 @@ import Home from './Home'; import Badge from './layouts/badge/Details'; import ButtonWithIcon from './layouts/button-with-icon/Details'; import Centering from './layouts/centering/Details'; +import FixedAtCorner from './layouts/fixed-at-corner/Details'; import HolyGrail from './layouts/holy-grail/Details'; import InputAddon from './layouts/input-add-on/Details'; import MediaObject from './layouts/media-object/Details'; @@ -22,6 +23,7 @@ const App = () => { + diff --git a/client/Home.jsx b/client/Home.jsx index f9b10c8..35db4b9 100644 --- a/client/Home.jsx +++ b/client/Home.jsx @@ -4,6 +4,7 @@ import { Link } from 'react-router-dom'; import BadgeCover from './layouts/badge/Cover'; import ButtonWithIconCover from './layouts/button-with-icon/Cover'; import CenterCover from './layouts/centering/Cover'; +import FixedAtCornerCover from './layouts/fixed-at-corner/Cover'; import HolyGrailCover from './layouts/holy-grail/Cover'; import InputAddonCover from './layouts/input-add-on/Cover'; import MediaObjectCover from './layouts/media-object/Cover'; @@ -85,6 +86,12 @@ const Home = () => {

Centering

+
+ + +

Fixed at corner

+ +
diff --git a/client/layouts/fixed-at-corner/Cover.jsx b/client/layouts/fixed-at-corner/Cover.jsx new file mode 100644 index 0000000..0857f72 --- /dev/null +++ b/client/layouts/fixed-at-corner/Cover.jsx @@ -0,0 +1,18 @@ +import React from 'react'; + +import Frame from '../../placeholders/Frame'; +import Triangle from '../../placeholders/Triangle'; + +const Cover = () => { + return ( + +
+
+ +
+
+ + ); +}; + +export default Cover; diff --git a/client/layouts/fixed-at-corner/Details.jsx b/client/layouts/fixed-at-corner/Details.jsx new file mode 100644 index 0000000..062bcc8 --- /dev/null +++ b/client/layouts/fixed-at-corner/Details.jsx @@ -0,0 +1,83 @@ +import React from 'react'; + +import DetailsLayout from '../../DetailsLayout'; +import BrowserFrame from '../../placeholders/BrowserFrame'; +import Triangle from '../../placeholders/Triangle'; +import SampleCode from '../../SampleCode'; +import useDocumentTitle from '../../useDocumentTitle'; + +const Details = () => { + useDocumentTitle('CSS Layout ∙ Fixed at corner'); + + return ( + +

Fixed at corner

+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ } + source={ + + +
+ ... +
+ + +
+ ... +
+ + +
+ ... +
+ + +
+ ... +
+ +`} +/> + } + /> + + ); +}; + +export default Details;