diff --git a/contents/_includes/patterns/full-background.njk b/contents/_includes/patterns/full-background.njk new file mode 100644 index 0000000..00cd148 --- /dev/null +++ b/contents/_includes/patterns/full-background.njk @@ -0,0 +1,3 @@ +
+ {% lines "hor", 10 %} +
\ No newline at end of file diff --git a/contents/full-background.md b/contents/full-background.md new file mode 100644 index 0000000..c4adb02 --- /dev/null +++ b/contents/full-background.md @@ -0,0 +1,37 @@ +--- +layout: layouts/post.njk +title: Full background +description: Create a full background element with CSS +keywords: css background size cover, css full background +--- + +## HTML + +```html +
+ ... +
+``` + +## CSS + +```css +.full-background { + /* Center the content */ + align-items: center; + display: flex; + flex-direction: column; + justify-content: center; + + /* Take full size */ + height: 100vh; + width: 100%; + + /* Background */ + background: url('/assets/full-background.jpeg') center center / cover no-repeat; +} +``` + +{% demo %} +{% include "patterns/full-background.njk" %} +{% enddemo %} diff --git a/contents/index.njk b/contents/index.njk index d331999..b333a4e 100644 --- a/contents/index.njk +++ b/contents/index.njk @@ -151,6 +151,12 @@ eleventyExcludeFromCollections: true
Fixed at side
+
+ +
{% include "patterns/full-background.njk" %}
+
Full background
+
+
diff --git a/pages/full-background/index.tsx b/pages/full-background/index.tsx deleted file mode 100644 index 7ba8e24..0000000 --- a/pages/full-background/index.tsx +++ /dev/null @@ -1,75 +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 Block from '../../placeholders/Block'; -import BrowserFrame from '../../placeholders/BrowserFrame'; - -const Details: React.FC<{}> = () => { - return ( - - - - - - - - - ... - -`} - css={` - .container { - /* Center the content */ - align-items: center; - display: flex; - flex-direction: column; - justify-content: center; - - /* Take full size */ - height: 100vh; - width: 100%; - - /* Background */ - background: url('/assets/full-background.jpeg') center center / cover no-repeat; - } - `} - > -
-
-
- -
-
-
-
- - -
- ); -}; - -export default Details; diff --git a/patterns/full-background/Cover.tsx b/patterns/full-background/Cover.tsx deleted file mode 100644 index 259197f..0000000 --- a/patterns/full-background/Cover.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import * as React from 'react'; - -import Frame from '../../placeholders/Frame'; -import Line from '../../placeholders/Line'; - -const Cover: React.FC<{}> = () => { - return ( - -
-
- -
-
- -
-
- -
-
- - ); -}; - -export default Cover; diff --git a/styles/index.scss b/styles/index.scss index 3bb78f7..4455561 100644 --- a/styles/index.scss +++ b/styles/index.scss @@ -34,6 +34,7 @@ @import './patterns/feature-list'; @import './patterns/fixed-at-corner'; @import './patterns/fixed-at-side'; +@import './patterns/full-background'; // Placeholders @import './placeholders/circle'; diff --git a/styles/patterns/_full-background.scss b/styles/patterns/_full-background.scss new file mode 100644 index 0000000..7a461b6 --- /dev/null +++ b/styles/patterns/_full-background.scss @@ -0,0 +1,13 @@ +.full-background { + /* Center the content */ + align-items: center; + display: flex; + flex-direction: column; + justify-content: center; + + /* Take full size */ + height: 100%; + width: 100%; + + background: url('/assets/full-background.jpeg') center center / cover no-repeat; +} \ No newline at end of file