diff --git a/contents/_includes/patterns/popover-arrow.njk b/contents/_includes/patterns/popover-arrow.njk new file mode 100644 index 0000000..0cb71e6 --- /dev/null +++ b/contents/_includes/patterns/popover-arrow.njk @@ -0,0 +1,14 @@ +
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/contents/index.njk b/contents/index.njk index 002f708..aca6c0c 100644 --- a/contents/index.njk +++ b/contents/index.njk @@ -69,5 +69,12 @@ eleventyExcludeFromCollections: true +
+

Feedback

+
+ {% pattern "Popover arrow" %}{% include "patterns/popover-arrow.njk" %}{% endpattern %} +
+
+ {% include "follow.njk" %} \ No newline at end of file diff --git a/contents/popover-arrow.md b/contents/popover-arrow.md new file mode 100644 index 0000000..ce8439e --- /dev/null +++ b/contents/popover-arrow.md @@ -0,0 +1,208 @@ +--- +layout: layouts/post.njk +title: Popover arrow +description: Create a popover arrow with CSS +keywords: css arrow, css popover +--- + +## HTML + +```html +
+ + ... + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+``` + +## CSS + +```css +.popover-arrow { + /* Border */ + border: 1px solid #d1d5db; + + /* Used to position the arrow */ + position: relative; +} + +.popover-arrow__arrow { + /* Size */ + height: 0.5rem; + width: 0.5rem; + + background-color: #fff; + position: absolute; +} + +.popover-arrow__arrow--tl { + /* Position at the top left corner */ + left: 1rem; + top: 0; + + /* Border */ + border-left: 1px solid #d1d5db; + border-top: 1px solid #d1d5db; + transform: translate(50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--tc { + /* Position at the top center */ + left: 50%; + top: 0; + + /* Border */ + border-left: 1px solid #d1d5db; + border-top: 1px solid #d1d5db; + transform: translate(-50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--tr { + /* Position at the top right corner */ + right: 1rem; + top: 0; + + /* Border */ + border-left: 1px solid #d1d5db; + border-top: 1px solid #d1d5db; + transform: translate(-50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--rt { + /* Position at the right top corner */ + right: 0; + top: 1rem; + + /* Border */ + border-right: 1px solid #d1d5db; + border-top: 1px solid #d1d5db; + transform: translate(50%, 50%) rotate(45deg); +} + +.popover-arrow__arrow--rc { + /* Position at the right center */ + right: 0; + top: 50%; + + /* Border */ + border-right: 1px solid #d1d5db; + border-top: 1px solid #d1d5db; + transform: translate(50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--rb { + /* Position at the right bottom corner */ + bottom: 1rem; + right: 0; + + /* Border */ + border-right: 1px solid #d1d5db; + border-top: 1px solid #d1d5db; + transform: translate(50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--bl { + /* Position at the bottom left corner */ + bottom: -0.5rem; + left: 1rem; + + /* Border */ + border-bottom: 1px solid #d1d5db; + border-right: 1px solid #d1d5db; + transform: translate(50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--bc { + /* Position at the bottom center */ + bottom: -0.5rem; + left: 50%; + + /* Border */ + border-bottom: 1px solid #d1d5db; + border-right: 1px solid #d1d5db; + transform: translate(-50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--br { + /* Position at the bottom right corner */ + bottom: -0.5rem; + right: 1rem; + + /* Border */ + border-bottom: 1px solid #d1d5db; + border-right: 1px solid #d1d5db; + transform: translate(-50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--lt { + /* Position at the left top corner */ + left: 0; + top: 1rem; + + /* Border */ + border-bottom: 1px solid #d1d5db; + border-left: 1px solid #d1d5db; + transform: translate(-50%, 50%) rotate(45deg); +} + +.popover-arrow__arrow--lc { + /* Position at the left center */ + left: 0; + top: 50%; + + /* Border */ + border-bottom: 1px solid #d1d5db; + border-left: 1px solid #d1d5db; + transform: translate(-50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--lb { + /* Position at the left bottom corner */ + bottom: 1rem; + left: 0; + + /* Border */ + border-bottom: 1px solid #d1d5db; + border-left: 1px solid #d1d5db; + transform: translate(-50%, -50%) rotate(45deg); +} +``` + +{% demo %} +{% include "patterns/popover-arrow.njk" %} +{% enddemo %} diff --git a/pages/popover-arrow/index.tsx b/pages/popover-arrow/index.tsx deleted file mode 100644 index 76762e1..0000000 --- a/pages/popover-arrow/index.tsx +++ /dev/null @@ -1,401 +0,0 @@ -import * as React from 'react'; -import Head from 'next/head'; -import { Spacer } from '@1milligram/design'; - -import { RelatedPatterns } from '../../components/RelatedPatterns'; -import { Pattern } from '../../constants/Pattern'; -import { PatternLayout } from '../../layouts/PatternLayout'; -import BrowserFrame from '../../placeholders/BrowserFrame'; - -const Details: React.FC<{}> = () => { - return ( - - - - - - - - - - ... - - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- -`} - css={` - .container { - /* Border */ - border: 1px solid rgba(0, 0, 0, 0.3); - - /* Used to position the arrow */ - position: relative; - } - - .container__arrow { - /* Size */ - height: 16px; - width: 16px; - - background-color: #fff; - position: absolute; - } - - .container__arrow--tl { - /* Position at the top left corner */ - left: 32px; - top: 0px; - - /* Border */ - border-left: 1px solid rgba(0, 0, 0, 0.3); - border-top: 1px solid rgba(0, 0, 0, 0.3); - transform: translate(50%, -50%) rotate(45deg); - } - - .container__arrow--tc { - /* Position at the top center */ - left: 50%; - top: 0px; - - /* Border */ - border-left: 1px solid rgba(0, 0, 0, 0.3); - border-top: 1px solid rgba(0, 0, 0, 0.3); - transform: translate(-50%, -50%) rotate(45deg); - } - - .container__arrow--tr { - /* Position at the top right corner */ - right: 32px; - top: 0px; - - /* Border */ - border-left: 1px solid rgba(0, 0, 0, 0.3); - border-top: 1px solid rgba(0, 0, 0, 0.3); - transform: translate(-50%, -50%) rotate(45deg); - } - - .container__arrow--rt { - /* Position at the right top corner */ - right: 0; - top: 32px; - - /* Border */ - border-right: 1px solid rgba(0, 0, 0, 0.3); - border-top: 1px solid rgba(0, 0, 0, 0.3); - transform: translate(50%, 50%) rotate(45deg); - } - - .container__arrow--rc { - /* Position at the right center */ - right: 0; - top: 50%; - - /* Border */ - border-right: 1px solid rgba(0, 0, 0, 0.3); - border-top: 1px solid rgba(0, 0, 0, 0.3); - transform: translate(50%, -50%) rotate(45deg); - } - - .container__arrow--rb { - /* Position at the right bottom corner */ - bottom: 32px; - right: 0; - - /* Border */ - border-right: 1px solid rgba(0, 0, 0, 0.3); - border-top: 1px solid rgba(0, 0, 0, 0.3); - transform: translate(50%, -50%) rotate(45deg); - } - - .container__arrow--bl { - /* Position at the bottom left corner */ - bottom: -16px; - left: 32px; - - /* Border */ - border-bottom: 1px solid rgba(0, 0, 0, 0.3); - border-right: 1px solid rgba(0, 0, 0, 0.3); - transform: translate(50%, -50%) rotate(45deg); - } - - .container__arrow--bc { - /* Position at the bottom center */ - bottom: -16px; - left: 50%; - - /* Border */ - border-bottom: 1px solid rgba(0, 0, 0, 0.3); - border-right: 1px solid rgba(0, 0, 0, 0.3); - transform: translate(-50%, -50%) rotate(45deg); - } - - .container__arrow--br { - /* Position at the bottom right corner */ - bottom: -16px; - right: 32px; - - /* Border */ - border-bottom: 1px solid rgba(0, 0, 0, 0.3); - border-right: 1px solid rgba(0, 0, 0, 0.3); - transform: translate(-50%, -50%) rotate(45deg); - } - - .container__arrow--lt { - /* Position at the left top corner */ - left: 0; - top: 32px; - - /* Border */ - border-bottom: 1px solid rgba(0, 0, 0, 0.3); - border-left: 1px solid rgba(0, 0, 0, 0.3); - transform: translate(-50%, 50%) rotate(45deg); - } - - .container__arrow--lc { - /* Position at the left center */ - left: 0; - top: 50%; - - /* Border */ - border-bottom: 1px solid rgba(0, 0, 0, 0.3); - border-left: 1px solid rgba(0, 0, 0, 0.3); - transform: translate(-50%, -50%) rotate(45deg); - } - - .container__arrow--lb { - /* Position at the left bottom corner */ - bottom: 32px; - left: 0; - - /* Border */ - border-bottom: 1px solid rgba(0, 0, 0, 0.3); - border-left: 1px solid rgba(0, 0, 0, 0.3); - transform: translate(-50%, -50%) rotate(45deg); - } - `} - > -
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
- - - - - ); -}; - -export default Details; diff --git a/patterns/popover-arrow/Cover.tsx b/patterns/popover-arrow/Cover.tsx deleted file mode 100644 index d25dd23..0000000 --- a/patterns/popover-arrow/Cover.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import * as React from 'react'; - -import Frame from '../../placeholders/Frame'; - -const Cover: React.FC<{}> = () => { - return ( - -
-
-
-
-
- - ); -}; - -export default Cover; diff --git a/styles/index.scss b/styles/index.scss index c9d24c5..25fa341 100644 --- a/styles/index.scss +++ b/styles/index.scss @@ -43,6 +43,7 @@ @import './patterns/lined-paper'; @import './patterns/media-object'; @import './patterns/overlay-play-button'; +@import './patterns/popover-arrow'; @import './patterns/price-tag'; @import './patterns/pricing-table'; @import './patterns/property-list'; diff --git a/styles/patterns/_popover-arrow.scss b/styles/patterns/_popover-arrow.scss new file mode 100644 index 0000000..e4e3ad7 --- /dev/null +++ b/styles/patterns/_popover-arrow.scss @@ -0,0 +1,152 @@ +.popover-arrow { + /* Border */ + border: 1px solid #d1d5db; + + /* Used to position the arrow */ + position: relative; + + /* Demo */ + height: 100%; + width: 100%; +} + +.popover-arrow__arrow { + /* Size */ + height: 1rem; + width: 1rem; + + background-color: #fff; + position: absolute; +} + +.popover-arrow__arrow--tl { + /* Position at the top left corner */ + left: 1rem; + top: 0; + + /* Border */ + border-left: 1px solid #d1d5db; + border-top: 1px solid #d1d5db; + transform: translate(50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--tc { + /* Position at the top center */ + left: 50%; + top: 0; + + /* Border */ + border-left: 1px solid #d1d5db; + border-top: 1px solid #d1d5db; + transform: translate(-50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--tr { + /* Position at the top right corner */ + right: 1rem; + top: 0; + + /* Border */ + border-left: 1px solid #d1d5db; + border-top: 1px solid #d1d5db; + transform: translate(-50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--rt { + /* Position at the right top corner */ + right: 0; + top: 1rem; + + /* Border */ + border-right: 1px solid #d1d5db; + border-top: 1px solid #d1d5db; + transform: translate(50%, 50%) rotate(45deg); +} + +.popover-arrow__arrow--rc { + /* Position at the right center */ + right: 0; + top: 50%; + + /* Border */ + border-right: 1px solid #d1d5db; + border-top: 1px solid #d1d5db; + transform: translate(50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--rb { + /* Position at the right bottom corner */ + bottom: 1rem; + right: 0; + + /* Border */ + border-right: 1px solid #d1d5db; + border-top: 1px solid #d1d5db; + transform: translate(50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--bl { + /* Position at the bottom left corner */ + bottom: -1rem; + left: 1rem; + + /* Border */ + border-bottom: 1px solid #d1d5db; + border-right: 1px solid #d1d5db; + transform: translate(50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--bc { + /* Position at the bottom center */ + bottom: -1rem; + left: 50%; + + /* Border */ + border-bottom: 1px solid #d1d5db; + border-right: 1px solid #d1d5db; + transform: translate(-50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--br { + /* Position at the bottom right corner */ + bottom: -1rem; + right: 1rem; + + /* Border */ + border-bottom: 1px solid #d1d5db; + border-right: 1px solid #d1d5db; + transform: translate(-50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--lt { + /* Position at the left top corner */ + left: 0; + top: 1rem; + + /* Border */ + border-bottom: 1px solid #d1d5db; + border-left: 1px solid #d1d5db; + transform: translate(-50%, 50%) rotate(45deg); +} + +.popover-arrow__arrow--lc { + /* Position at the left center */ + left: 0; + top: 50%; + + /* Border */ + border-bottom: 1px solid #d1d5db; + border-left: 1px solid #d1d5db; + transform: translate(-50%, -50%) rotate(45deg); +} + +.popover-arrow__arrow--lb { + /* Position at the left bottom corner */ + bottom: 1rem; + left: 0; + + /* Border */ + border-bottom: 1px solid #d1d5db; + border-left: 1px solid #d1d5db; + transform: translate(-50%, -50%) rotate(45deg); +} \ No newline at end of file