diff --git a/contents/_includes/patterns/sidebar.njk b/contents/_includes/patterns/sidebar.njk new file mode 100644 index 0000000..e139703 --- /dev/null +++ b/contents/_includes/patterns/sidebar.njk @@ -0,0 +1,8 @@ +
\ No newline at end of file diff --git a/contents/index.njk b/contents/index.njk index fe65b89..4de1006 100644 --- a/contents/index.njk +++ b/contents/index.njk @@ -113,6 +113,7 @@ eleventyExcludeFromCollections: true {% pattern "Holy grail" %}{% include "patterns/holy-grail.njk" %}{% endpattern %} {% pattern "Masonry grid" %}{% include "patterns/masonry-grid.njk" %}{% endpattern %} {% pattern "Same height columns" %}{% include "patterns/same-height-columns.njk" %}{% endpattern %} + {% pattern "Sidebar" %}{% include "patterns/sidebar.njk" %}{% endpattern %} diff --git a/contents/sidebar.md b/contents/sidebar.md new file mode 100644 index 0000000..6a8698f --- /dev/null +++ b/contents/sidebar.md @@ -0,0 +1,44 @@ +--- +layout: layouts/post.njk +title: Sidebar +description: Create a sidebar with CSS flexbox +keywords: css flexbox, css layout, css sidebar +--- + +## HTML + +```html + +``` + +## CSS + +```css +.sidebar { + display: flex; +} + +.sidebar__sidebar { + width: 30%; +} + +.sidebar__main { + /* Take the remaining width */ + flex: 1; + + /* Make it scrollable */ + overflow: auto; +} +``` + +{% demo %}{% include "patterns/sidebar.njk" %}{% enddemo %} diff --git a/pages/sidebar/index.tsx b/pages/sidebar/index.tsx deleted file mode 100644 index c34e3a1..0000000 --- a/pages/sidebar/index.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import * as React from 'react'; -import Head from 'next/head'; - -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 ( -