1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-08 07:07:15 +02:00

Use BEM naming convention

This commit is contained in:
Phuoc Nguyen
2021-04-01 16:46:44 +07:00
parent e1b4c6efa2
commit 538e5f750e
37 changed files with 233 additions and 214 deletions

View File

@@ -66,22 +66,22 @@ const Details: React.FC<{}> = () => {
<BrowserFrame <BrowserFrame
html={` html={`
<!-- Container --> <!-- Container -->
<div class="container"> <div class="accordion">
<!-- Each accordion item --> <!-- Each accordion item -->
<div class="item"> <div class="accordion__item">
<!-- Heading --> <!-- Heading -->
<div class="header"> <div class="accordion__header">
<!-- The toggle icon --> <!-- The toggle icon -->
<div class="toggle">...</div> <div class="accordion__toggle">...</div>
<!-- The title --> <!-- The title -->
<div class="title"> <div class="accordion__title">
... ...
</div> </div>
</div> </div>
<!-- The content --> <!-- The content -->
<div class="content"> <div class="accordion__content">
... ...
</div> </div>
</div> </div>
@@ -91,18 +91,18 @@ html={`
</div> </div>
`} `}
css={` css={`
.container { .accordion {
/* Border */ /* Border */
border: 1px solid rgba(0, 0, 0, 0.3); border: 1px solid rgba(0, 0, 0, 0.3);
border-bottom-color: transparent; border-bottom-color: transparent;
border-radius: 4px; border-radius: 4px;
} }
.item { .accordion__item {
border-bottom: 1px solid rgba(0, 0, 0, 0.3); border-bottom: 1px solid rgba(0, 0, 0, 0.3);
} }
.header { .accordion__header {
/* Center the content horizontally */ /* Center the content horizontally */
align-items: center; align-items: center;
display: flex; display: flex;
@@ -110,22 +110,25 @@ css={`
cursor: pointer; cursor: pointer;
padding: 16px; padding: 16px;
} }
.toggle {
.accordion__toggle {
margin-right: 12px; margin-right: 12px;
} }
.title {
.accordion__title {
/* Take remaining width */ /* Take remaining width */
flex: 1; flex: 1;
} }
.content { .accordion__content {
/* For not selected item */ /* For not selected item */
display: none; display: none;
border-top: 1px solid rgba(0, 0, 0, 0.3); border-top: 1px solid rgba(0, 0, 0, 0.3);
padding: 16px; padding: 16px;
} }
.content.selected {
.accordion__content--selected {
/* For selected item */ /* For selected item */
display: block; display: block;
} }

View File

@@ -22,43 +22,43 @@ const Details: React.FC<{}> = () => {
<BrowserFrame <BrowserFrame
html={` html={`
<!-- Up arrow button --> <!-- Up arrow button -->
<button class="container"> <button class="button">
<!-- Arrow --> <!-- Arrow -->
<div class="container__arrow container__arrow--up"></div> <div class="button__arrow button__arrow--up"></div>
<!-- Content --> <!-- Content -->
... ...
</button> </button>
<!-- Right arrow button --> <!-- Right arrow button -->
<button class="container"> <button class="button">
<!-- Content --> <!-- Content -->
... ...
<!-- Arrow --> <!-- Arrow -->
<div class="container__arrow container__arrow--right"></div> <div class="button__arrow button__arrow--right"></div>
</button> </button>
<!-- Down arrow button --> <!-- Down arrow button -->
<button class="container"> <button class="button">
<!-- Arrow --> <!-- Arrow -->
<div class="container__arrow container__arrow--down"></div> <div class="button__arrow button__arrow--down"></div>
<!-- Content --> <!-- Content -->
... ...
</button> </button>
<!-- Left arrow button --> <!-- Left arrow button -->
<button class="container"> <button class="button">
<!-- Arrow --> <!-- Arrow -->
<div class="container__arrow container__arrow--left"></div> <div class="button__arrow button__arrow--left"></div>
<!-- Content --> <!-- Content -->
... ...
</button> </button>
`} `}
css={` css={`
.container { .button {
/* Center the content */ /* Center the content */
align-items: center; align-items: center;
display: flex; display: flex;
@@ -68,7 +68,7 @@ css={`
padding: 8px; padding: 8px;
} }
.container__arrow { .button__arrow {
/* Transparent background */ /* Transparent background */
background-color: transparent; background-color: transparent;
@@ -77,28 +77,28 @@ css={`
width: 12px; width: 12px;
} }
.container__arrow--up { .button__arrow--up {
/* Edges */ /* Edges */
border-left: 1px solid rgba(0, 0, 0, 0.3); border-left: 1px solid rgba(0, 0, 0, 0.3);
border-top: 1px solid rgba(0, 0, 0, 0.3); border-top: 1px solid rgba(0, 0, 0, 0.3);
transform: translateY(25%) rotate(45deg); transform: translateY(25%) rotate(45deg);
} }
.container__arrow--right { .button__arrow--right {
/* Edges */ /* Edges */
border-right: 1px solid rgba(0, 0, 0, 0.3); border-right: 1px solid rgba(0, 0, 0, 0.3);
border-top: 1px solid rgba(0, 0, 0, 0.3); border-top: 1px solid rgba(0, 0, 0, 0.3);
transform: translateX(-25%) rotate(45deg); transform: translateX(-25%) rotate(45deg);
} }
.container__arrow--down { .button__arrow--down {
/* Edges */ /* Edges */
border-bottom: 1px solid rgba(0, 0, 0, 0.3); border-bottom: 1px solid rgba(0, 0, 0, 0.3);
border-right: 1px solid rgba(0, 0, 0, 0.3); border-right: 1px solid rgba(0, 0, 0, 0.3);
transform: translateY(-25%) rotate(45deg); transform: translateY(-25%) rotate(45deg);
} }
.container__arrow--left { .button__arrow--left {
/* Edges */ /* Edges */
border-bottom: 1px solid rgba(0, 0, 0, 0.3); border-bottom: 1px solid rgba(0, 0, 0, 0.3);
border-left: 1px solid rgba(0, 0, 0, 0.3); border-left: 1px solid rgba(0, 0, 0, 0.3);

View File

@@ -41,10 +41,10 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="avatars">
<!-- Avatar item --> <!-- Avatar item -->
<div class="container__item"> <div class="avatars__item">
<div class="container__avatar"> <div class="avatars__image">
<!-- Image --> <!-- Image -->
... ...
</div> </div>
@@ -55,16 +55,16 @@ html={`
</div> </div>
`} `}
css={` css={`
.container { .avatars {
display: flex; display: flex;
} }
.container__item { .avatars__item {
/* Nagative margin make avatar overlap to previous one */ /* Nagative margin make avatar overlap to previous one */
margin-left: -4px; margin-left: -4px;
} }
.container__avatar { .avatars__image {
/* Add a white curve between avatars */ /* Add a white curve between avatars */
box-shadow: 0 0 0 4px #FFF; box-shadow: 0 0 0 4px #FFF;

View File

@@ -21,20 +21,20 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="avatar">
<!-- Avatar image --> <!-- Avatar image -->
<img class="container__avatar" src="..." /> <img class="avatar__image" src="..." />
</div> </div>
`} `}
css={` css={`
.container { .avatar {
/* Rounded border */ /* Rounded border */
border-radius: 50%; border-radius: 50%;
height: 64px; height: 64px;
width: 64px; width: 64px;
} }
.container__avatar { .avatar__image {
/* Rounded border */ /* Rounded border */
border-radius: 50%; border-radius: 50%;

View File

@@ -21,12 +21,12 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="badge">
... ...
</div> </div>
`} `}
css={` css={`
.container { .badge {
/* Center the content */ /* Center the content */
align-items: center; align-items: center;
display: flex; display: flex;

View File

@@ -21,24 +21,25 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="breadcrumb">
<!-- Breadcrumb item --> <!-- Breadcrumb item -->
<a>...</a> <a>...</a>
<!-- Separator --> <!-- Separator -->
<div class="separator">/</div> <div class="breadcrumb__separator">/</div>
<!-- Repeated items and separators --> <!-- Repeated items and separators -->
... ...
</div> </div>
`} `}
css={` css={`
.container { .breadcrumb {
/* Content is centered vertically */ /* Content is centered vertically */
align-items: center; align-items: center;
display: flex; display: flex;
} }
.separator {
.breadcrumb__separator {
margin: 0 8px; margin: 0 8px;
} }
`} `}

View File

@@ -22,9 +22,9 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="cards">
<!-- A card with given width --> <!-- A card with given width -->
<div class="card"> <div class="cards__item">
... ...
</div> </div>
@@ -33,7 +33,7 @@ html={`
</div> </div>
`} `}
css={` css={`
.container { .cards {
display: flex; display: flex;
/* Put a card in the next row when previous cards take all width */ /* Put a card in the next row when previous cards take all width */
@@ -42,7 +42,8 @@ css={`
margin-left: -8px; margin-left: -8px;
margin-right: -8px; margin-right: -8px;
} }
.card {
.cards__item {
/* There will be 4 cards per row */ /* There will be 4 cards per row */
flex-basis: 25%; flex-basis: 25%;

View File

@@ -23,31 +23,31 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="card">
<!-- Cover --> <!-- Cover -->
<div class="container__cover"> <div class="card__cover">
... ...
</div> </div>
<!-- Content --> <!-- Content -->
<div class="container__content"> <div class="card__content">
... ...
</div> </div>
... ...
</div> </div>
`} `}
css={` css={`
.container { .card {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.container__cover { .card__cover {
height: 150px; height: 150px;
width: 100%; width: 100%;
} }
.container__content { .card__content {
/* Take available height */ /* Take available height */
flex: 1; flex: 1;
} }

View File

@@ -57,15 +57,14 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="navigation">
<!-- The trigger element that will show all circles when user clicks it --> <!-- The trigger element that will show all circles when user clicks it -->
... ...
<!-- A circle menu item --> <!-- A circle menu item -->
<div class="item"> <div class="navigation__circle">
<!-- The inner --> <!-- The content -->
<div class="inner"> <div class="navigation__content">
<!-- The content -->
... ...
</div> </div>
</div> </div>
@@ -75,10 +74,11 @@ html={`
</div> </div>
`} `}
css={` css={`
.container { .navigation {
position: relative; position: relative;
} }
.item {
.navigation__circle {
/* Position */ /* Position */
position: absolute; position: absolute;
top: 0; top: 0;
@@ -95,7 +95,8 @@ css={`
height: 32px; height: 32px;
width: 32px; width: 32px;
} }
.inner {
.navigation__content {
/* /*
Rotate it to make it displayed vertically Rotate it to make it displayed vertically
Replace -0deg with -60deg, -180deg, -240deg, -300deg for another item Replace -0deg with -60deg, -180deg, -240deg, -300deg for another item

View File

@@ -21,14 +21,14 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<button class="container"> <button class="button">
<div class="container__line container__line--first"></div> <div class="button__line button__line--first"></div>
<div class="container__line container__line--second"></div> <div class="button__line button__line--second"></div>
</button> </button>
`} `}
css={` css={`
.container { .button {
/* Reset */ /* Reset */
background-color: transparent; background-color: transparent;
border-color: transparent; border-color: transparent;
@@ -44,7 +44,7 @@ css={`
position: relative; position: relative;
} }
.container__line { .button__line {
/* Background color */ /* Background color */
background-color: rgba(0, 0, 0, 0.3); background-color: rgba(0, 0, 0, 0.3);
@@ -56,7 +56,7 @@ css={`
width: 100%; width: 100%;
} }
.container__line--first { .button__line--first {
/* Position */ /* Position */
left: 0px; left: 0px;
top: 50%; top: 50%;
@@ -67,7 +67,7 @@ css={`
width: 100%; width: 100%;
} }
.container__line--second { .button__line--second {
/* Position */ /* Position */
left: 50%; left: 50%;
top: 0px; top: 0px;

View File

@@ -23,9 +23,9 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="banner">
<!-- Tells visitors that the website uses cookie --> <!-- Tells visitors that the website uses cookie -->
<div class="container__content"> <div class="banner__content">
... ...
</div> </div>
@@ -34,7 +34,7 @@ html={`
</div> </div>
`} `}
css={` css={`
.container { .banner {
/* Banner is displayed at the bottom */ /* Banner is displayed at the bottom */
bottom: 0; bottom: 0;
left: 0; left: 0;
@@ -47,7 +47,7 @@ css={`
justify-content: center; justify-content: center;
} }
.container__content { .banner__content {
/* Take available width */ /* Take available width */
flex: 1; flex: 1;
} }

View File

@@ -45,15 +45,15 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<ul class="container"> <ul class="dots">
<li class="item" /> <li class="dots__item"></li>
<!-- Repeat other dots --> <!-- Repeat other dots -->
... ...
</div> </div>
`} `}
css={` css={`
.container { .dots {
/* Center the content */ /* Center the content */
align-items: center; align-items: center;
display: flex; display: flex;
@@ -64,7 +64,8 @@ css={`
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.item {
.dots__item {
/* Rounded border */ /* Rounded border */
border-radius: 9999px; border-radius: 9999px;
height: 12px; height: 12px;

View File

@@ -26,10 +26,10 @@ const Details: React.FC<{}> = () => {
html={` html={`
<div class="container"> <div class="container">
<!-- Backdrop --> <!-- Backdrop -->
<div class="overlay"></div> <div class="container__overlay"></div>
<!-- Sidebar --> <!-- Sidebar -->
<div class="sidebar"> <div class="container__sidebar">
... ...
</div> </div>
</div> </div>
@@ -45,7 +45,8 @@ css={`
z-index: 9999; z-index: 9999;
} }
.overlay {
.container__overlay {
/* Take full size */ /* Take full size */
height: 100%; height: 100%;
left: 0; left: 0;
@@ -58,7 +59,8 @@ css={`
z-index: -1; z-index: -1;
} }
.sidebar {
.container__sidebar {
/* Take full height */ /* Take full height */
height: 100%; height: 100%;
left: 0; left: 0;

View File

@@ -34,7 +34,7 @@ html={`
<button>...</button> <button>...</button>
<!-- The content --> <!-- The content -->
<div class="dropdown-content"> <div class="dropdown__content">
... ...
</div> </div>
</div> </div>
@@ -45,7 +45,7 @@ css={`
} }
/* Hide the dropdown's content by default --> /* Hide the dropdown's content by default -->
.dropdown-content { .dropdown__content {
display: none; display: none;
/* Position it right below the trigger element */ /* Position it right below the trigger element */
@@ -64,7 +64,7 @@ css={`
} }
/* Show the content when hover on the container --> /* Show the content when hover on the container -->
.dropdown:hover .dropdown-content { .dropdown:hover .dropdown__content {
display: block; display: block;
} }
`} `}

View File

@@ -23,7 +23,7 @@ const Details: React.FC<{}> = () => {
html={` html={`
<div class="container"> <div class="container">
<!-- The close button --> <!-- The close button -->
<button class="close"> <button class="container__close">
... ...
</button> </button>
@@ -48,7 +48,7 @@ css={`
justify-content: center; justify-content: center;
} }
.close { .container__close {
/* Shown at top right corner */ /* Shown at top right corner */
position: absolute; position: absolute;
right: 16px; right: 16px;

View File

@@ -26,15 +26,15 @@ html={`
<header> <header>
... ...
</header> </header>
<main class="main"> <main class="container__main">
<!-- Left sidebar --> <!-- Left sidebar -->
<aside class="left">...</aside> <aside class="container__left">...</aside>
<!-- Main content --> <!-- Main content -->
<article class="middle">...</article> <article class="container__middle">...</article>
<!-- Right sidebar --> <!-- Right sidebar -->
<nav class="right">...</nav> <nav class="container__right">...</nav>
</main> </main>
<footer> <footer>
... ...
@@ -46,7 +46,8 @@ css={`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.main {
.container__main {
/* Take the remaining height */ /* Take the remaining height */
flex-grow: 1; flex-grow: 1;
@@ -54,14 +55,17 @@ css={`
display: flex; display: flex;
flex-direction: row; flex-direction: row;
} }
.left {
.container__left {
width: 25%; width: 25%;
} }
.middle {
.container__middle {
/* Take the remaining width */ /* Take the remaining width */
flex-grow: 1; flex-grow: 1;
} }
.right {
.container__right {
width: 20%; width: 20%;
} }
`} `}

View File

@@ -26,15 +26,15 @@ const Details: React.FC<{}> = () => {
</div> </div>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="avatar">
<div class="container__letters"> <div class="avatar__letters">
<!-- The letters --> <!-- The letters -->
... ...
</div> </div>
</div> </div>
`} `}
css={` css={`
.container { .avatar {
/* Center the content */ /* Center the content */
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
@@ -52,7 +52,7 @@ css={`
width: 48px; width: 48px;
} }
.container__letters { .avatar__letters {
/* Center the content */ /* Center the content */
left: 50%; left: 50%;
position: absolute; position: absolute;

View File

@@ -34,12 +34,12 @@ html={`
... ...
<!-- An item that triggers displaying the mega menu --> <!-- An item that triggers displaying the mega menu -->
<div class="trigger"> <div class="container__trigger">
<!-- The trigger item's content --> <!-- The trigger item's content -->
<div>...</div> <div>...</div>
<!-- Mega menu --> <!-- Mega menu -->
<div class="content"> <div class="container__content">
... ...
</div> </div>
</div> </div>
@@ -51,12 +51,12 @@ css={`
position: relative; position: relative;
} }
.trigger:hover .content { .container__trigger:hover .container__content {
/* Show the mega menu when hovering the trigger item */ /* Show the mega menu when hovering the trigger item */
display: block; display: block;
} }
.content { .container__content {
/* Border */ /* Border */
border: 1px solid rgba(0, 0, 0, 0.3); border: 1px solid rgba(0, 0, 0, 0.3);
margin-top: -1px; margin-top: -1px;

View File

@@ -25,39 +25,42 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="menu">
<!-- Normal menu item --> <!-- Normal menu item -->
<div class="item"> <div class="menu__item">
... ...
</div> </div>
<!-- With hot key --> <!-- With hot key -->
<div class="item with-shortcut"> <div class="menu__item">
<!-- Label --> <!-- Label -->
... ...
<!-- Hot key --> <!-- Hot key -->
... <div class="menu__hotkey">
...
</div>
</div> </div>
<!-- With image and hot key --> <!-- With image and hot key -->
<div class="item with-shortcut"> <div class="menu__item">
<div class="with-image"> <!-- Image -->
<!-- Image --> ...
...
<!-- Label --> <!-- Label -->
... ...
</div>
<!-- Hot key --> <!-- Hot key -->
... <div class="menu__hotkey">
...
</div>
</div> </div>
<!-- Divider --> <!-- Divider -->
<div class="divider"></div> <div class="menu__divider"></div>
</div> </div>
`} `}
css={` css={`
.container { .menu {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -66,23 +69,18 @@ css={`
border-radius: 4px; border-radius: 4px;
} }
.item { .menu__item {
/* Center the content horizontally */ /* Center the content horizontally */
align-items: center; align-items: center;
display: flex; display: flex;
} }
.with-shortcut { .menu__hotkey {
/* Push the hot key to the right */ /* Push the hot key to the right */
justify-content: space-between; margin-left: auto;
} }
.with-image { .menu__divider {
align-items: center;
display: flex;
}
.divider {
border-bottom: 1px solid rgba(0, 0, 0, 0.3); border-bottom: 1px solid rgba(0, 0, 0, 0.3);
height: 1px; height: 1px;
} }

View File

@@ -28,9 +28,9 @@ const Details: React.FC<{}> = () => {
</div> </div>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="modal">
<!-- Header --> <!-- Header -->
<div class="container__header"> <div class="modal__header">
<!-- Title --> <!-- Title -->
... ...
<!-- Close icon sticks to the right --> <!-- Close icon sticks to the right -->
@@ -41,26 +41,26 @@ html={`
... ...
<!-- Footer --> <!-- Footer -->
<div class="container__footer"> <div class="modal__footer">
... ...
</div> </div>
</div> </div>
`} `}
css={` css={`
.container { .modal {
/* Border */ /* Border */
border: 1px solid rgba(0, 0, 0.3); border: 1px solid rgba(0, 0, 0.3);
border-radius: 4px; border-radius: 4px;
} }
.container__header { .modal__header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
/* Border */ /* Border */
border-bottom: 1px solid rgba(0, 0, 0.3); border-bottom: 1px solid rgba(0, 0, 0.3);
} }
.container__footer { .modal__footer {
display: flex; display: flex;
/* Push the buttons to the right */ /* Push the buttons to the right */
justify-content: flex-end; justify-content: flex-end;

View File

@@ -26,7 +26,7 @@ const Details: React.FC<{}> = () => {
</div> </div>
<BrowserFrame <BrowserFrame
html={` html={`
<ul class="container"> <ul class="dropdown">
<li>Home</li> <li>Home</li>
<li> <li>
<div>Patterns</div> <div>Patterns</div>
@@ -53,7 +53,7 @@ html={`
</ul> </ul>
`} `}
css={` css={`
.container { .dropdown {
/* Border */ /* Border */
border: 1px solid rgba(0, 0, 0, 0.3); border: 1px solid rgba(0, 0, 0, 0.3);
display: flex; display: flex;
@@ -64,7 +64,7 @@ css={`
padding: 0; padding: 0;
} }
.container li { .dropdown li {
/* Spacing */ /* Spacing */
padding: 8px; padding: 8px;
@@ -73,7 +73,7 @@ css={`
} }
/* The sub dropdown */ /* The sub dropdown */
.container ul { .dropdown ul {
/* Border */ /* Border */
border: 1px solid rgba(0, 0, 0, 0.3); border: 1px solid rgba(0, 0, 0, 0.3);
@@ -95,19 +95,19 @@ css={`
} }
/* The second level sub dropdown */ /* The second level sub dropdown */
.container ul ul { .dropdown ul ul {
left: 100%; left: 100%;
position: absolute; position: absolute;
top: 0; top: 0;
} }
/* Change background color of list item when being hovered */ /* Change background color of list item when being hovered */
.container li:hover { .dropdown li:hover {
background-color: rgba(0, 0, 0, 0.1); background-color: rgba(0, 0, 0, 0.1);
} }
/* Show the direct sub dropdown when hovering the list item */ /* Show the direct sub dropdown when hovering the list item */
.container li:hover > ul { .dropdown li:hover > ul {
display: block; display: block;
} }
`} `}

View File

@@ -27,7 +27,7 @@ const Details: React.FC<{}> = () => {
</div> </div>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="notification">
<!-- Content --> <!-- Content -->
... ...
@@ -36,7 +36,7 @@ html={`
</div> </div>
`} `}
css={` css={`
.container { .notification {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }

View File

@@ -22,11 +22,9 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="pagination">
<!-- Pagination item --> <!-- Pagination item -->
<div style=" <div class="pagination__item">
">
... ...
</div> </div>
@@ -35,7 +33,7 @@ html={`
</div> </div>
`} `}
css={` css={`
.container { .pagination {
display: flex; display: flex;
/* Border */ /* Border */
@@ -43,7 +41,7 @@ css={`
border-radius: 4px; border-radius: 4px;
} }
.item { .pagination__item {
/* Center the content */ /* Center the content */
align-items: center; align-items: center;
display: flex; display: flex;
@@ -52,7 +50,7 @@ css={`
/* Right border */ /* Right border */
border-right: 1px solid rgba(0, 0, 0, 0.3); border-right: 1px solid rgba(0, 0, 0, 0.3);
} }
.item + .item { .pagination__item + .pagination__item {
/* No right border */ /* No right border */
border-right: none; border-right: none;
} }

View File

@@ -24,12 +24,12 @@ const Details: React.FC<{}> = () => {
html={` html={`
<div class="container"> <div class="container">
<!-- Column --> <!-- Column -->
<div class="column"> <div class="container__column">
<!-- Cover --> <!-- Cover -->
... ...
<!-- Content --> <!-- Content -->
<div class="content"> <div class="container__content">
... ...
</div> </div>
@@ -45,7 +45,8 @@ css={`
.container { .container {
display: flex; display: flex;
} }
.column {
.container__column {
flex: 1; flex: 1;
/* Space between columns */ /* Space between columns */
margin: 0 8px; margin: 0 8px;
@@ -54,7 +55,8 @@ css={`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.content {
.container__content {
/* Take available height */ /* Take available height */
flex: 1; flex: 1;
} }

View File

@@ -24,12 +24,12 @@ const Details: React.FC<{}> = () => {
html={` html={`
<div class="container"> <div class="container">
<!-- Sidebar --> <!-- Sidebar -->
<aside class="sidebar"> <aside class="container__sidebar">
... ...
</aside> </aside>
<!-- Main --> <!-- Main -->
<main class="main"> <main class="container__main">
... ...
</main> </main>
</div> </div>
@@ -38,10 +38,12 @@ css={`
.container { .container {
display: flex; display: flex;
} }
.sidebar {
.container__sidebar {
width: 30%; width: 30%;
} }
.main {
.container__main {
/* Take the remaining width */ /* Take the remaining width */
flex: 1; flex: 1;

View File

@@ -25,10 +25,10 @@ html={`
<!-- Row --> <!-- Row -->
<div class="row"> <div class="row">
<!--Cell with given width. Replace 25% with whatever you want --> <!--Cell with given width. Replace 25% with whatever you want -->
<div class="cell width-1/4">25%</div> <div class="row__cell row__cell--1/4">25%</div>
<!-- Cell that takes remaining width --> <!-- Cell that takes remaining width -->
<div class="cell width-fill"> <div class="row__cell row__cell--fill">
... ...
</div> </div>
</div> </div>
@@ -40,16 +40,18 @@ css={`
margin-left: -8px; margin-left: -8px;
margin-right: -8px; margin-right: -8px;
} }
.cell {
.row__cell {
padding-left: 8px; padding-left: 8px;
padding-right: 8px; padding-right: 8px;
} }
/* Cell with given width. Replace 25% with whatever you want */ /* Cell with given width. Replace 25% with whatever you want */
.cell.width-1/4 { .row__cell--1/4 {
flex: 0 0 25%; flex: 0 0 25%;
} }
.cell.width-fill {
.row__cell--fill {
flex: 1; flex: 1;
} }
`} `}

View File

@@ -29,17 +29,17 @@ const Details: React.FC<{}> = () => {
html={` html={`
<div class="container"> <div class="container">
<!-- Input --> <!-- Input -->
<input type="text" class="input" /> <input type="text" class="container__input" />
<!-- Buttons container --> <!-- Buttons container -->
<div class="buttons"> <div class="container__buttons">
<!-- Up button --> <!-- Up button -->
<button class="button"> <button class="container__button">
... ...
</button> </button>
<!-- Down button --> <!-- Down button -->
<button class="button"> <button class="container__button">
... ...
</button> </button>
</div> </div>
@@ -52,21 +52,21 @@ css={`
display: flex; display: flex;
} }
.input { .container__input {
border-color: transparent; border-color: transparent;
margin-right: 4px; margin-right: 4px;
padding: 4px; padding: 4px;
width: 100px; width: 100px;
} }
.buttons { .container__buttons {
/* Content is centered vertically */ /* Content is centered vertically */
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
} }
.button { .container__button {
border-color: transparent; border-color: transparent;
/* Make buttons have the same height */ /* Make buttons have the same height */
flex: 1, flex: 1,

View File

@@ -29,7 +29,7 @@ html={`
</li> </li>
<!-- Navigation item that sticks to the right --> <!-- Navigation item that sticks to the right -->
<li class="item-right"> <li class="container__item--right">
<a href="">...</a> <a href="">...</a>
</li> </li>
</ul> </ul>
@@ -45,7 +45,7 @@ css={`
margin: 0; margin: 0;
} }
.item-right { .container__item--right {
/* Sticks to the right */ /* Sticks to the right */
margin-left: auto; margin-left: auto;
} }

View File

@@ -25,12 +25,12 @@ const Details: React.FC<{}> = () => {
html={` html={`
<div class="container"> <div class="container">
<!-- Left content --> <!-- Left content -->
<div class="half"> <div class="container__half">
... ...
</div> </div>
<!-- Right content --> <!-- Right content -->
<div class="half"> <div class="container__half">
... ...
</div> </div>
</div> </div>
@@ -39,7 +39,8 @@ css={`
.container { .container {
display: flex; display: flex;
} }
.half {
.container__half {
flex: 1; flex: 1;
} }
`} `}

View File

@@ -30,21 +30,21 @@ const Details: React.FC<{}> = () => {
<div className='p-8 pb-20'> <div className='p-8 pb-20'>
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="stepper">
<!-- Minus button --> <!-- Minus button -->
<button class="button">-</button> <button class="stepper__button">-</button>
<!-- Input container --> <!-- Input container -->
<div class="input-container"> <div class="stepper__content">
<input type="text" class="input" /> <input type="text" class="stepper__input" />
</div> </div>
<!-- Plus button --> <!-- Plus button -->
<button class="button">+</button> <button class="stepper__button">+</button>
</div> </div>
`} `}
css={` css={`
.container { .stepper {
display: flex; display: flex;
/* Border */ /* Border */
@@ -55,7 +55,7 @@ css={`
width: 128px; width: 128px;
} }
.button { .stepper__button {
/* Center the content */ /* Center the content */
align-items: center; align-items: center;
display: flex; display: flex;
@@ -65,11 +65,11 @@ css={`
width: 32px; width: 32px;
} }
.input-container { .stepper__content {
flex: 1 flex: 1;
} }
.input { .stepper__input {
/* Take full size of its container */ /* Take full size of its container */
height: 100%; height: 100%;
width: 100%; width: 100%;

View File

@@ -26,13 +26,13 @@ const Details: React.FC<{}> = () => {
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="container">
<header class="header"> <header class="container__header">
... ...
</header> </header>
<main class="main"> <main class="container__main">
... ...
</main> </main>
<footer class="footer"> <footer class="container__footer">
... ...
</footer> </footer>
</div> </div>
@@ -43,11 +43,13 @@ css={`
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
} }
.header,
.footer { .container__header,
.container__footer {
flex-shrink: 0; flex-shrink: 0;
} }
.main {
.container__main {
flex-grow: 1; flex-grow: 1;
} }
`} `}

View File

@@ -25,7 +25,7 @@ const Details: React.FC<{}> = () => {
<BrowserFrame <BrowserFrame
html={` html={`
<div class="container"> <div class="container">
<section class="section"> <section class="container__section">
... ...
</section> </section>
@@ -38,7 +38,8 @@ css={`
height: 100%; height: 100%;
overflow: scroll; overflow: scroll;
} }
.section {
.container__section {
/* Take full size */ /* Take full size */
height: 100%; height: 100%;
width: 100%; width: 100%;

View File

@@ -29,10 +29,10 @@ const Details: React.FC<{}> = () => {
<BrowserFrame <BrowserFrame
html={` html={`
<label class="label"> <label class="label">
<input type="checkbox" class="input" /> <input type="checkbox" class="label__input" />
<!-- Circle --> <!-- Circle -->
<div class="circle"></div> <div class="label__circle"></div>
</label> </label>
`} `}
css={` css={`
@@ -57,12 +57,12 @@ css={`
justify-content: flex-end; justify-content: flex-end;
} }
.input { .label__input {
/* Hide the input */ /* Hide the input */
display: none; display: none;
} }
.circle { .label__circle {
/* Rounded border */ /* Rounded border */
border-radius: 9999px; border-radius: 9999px;

View File

@@ -49,12 +49,12 @@ const Details: React.FC<{}> = () => {
html={` html={`
<div class="tabs"> <div class="tabs">
<!-- Active tab --> <!-- Active tab -->
<div class="tab--active"> <div class="tabs__tab--active">
... ...
</div> </div>
<!-- Inactive tab --> <!-- Inactive tab -->
<div class="tab--inactive"> <div class="tabs__tab--inactive">
... ...
</div> </div>
</div> </div>
@@ -67,7 +67,7 @@ css={`
justify-content: center; justify-content: center;
} }
.tab--active { .tabs__tab--active {
/* Border */ /* Border */
border: 1px solid rgba(0, 0, 0, 0.3); border: 1px solid rgba(0, 0, 0, 0.3);
/* Hide the bottom border */ /* Hide the bottom border */
@@ -78,7 +78,7 @@ css={`
border-top-right-radius: 2px; border-top-right-radius: 2px;
} }
.tab--inactive { .tabs__tab--inactive {
/* Has only the bottom border */ /* Has only the bottom border */
border-bottom: 1px solid rgba(0, 0, 0, 0.3); border-bottom: 1px solid rgba(0, 0, 0, 0.3);
} }

View File

@@ -25,7 +25,7 @@ const Details: React.FC<{}> = () => {
html={` html={`
<div class="container"> <div class="container">
<!-- Text input --> <!-- Text input -->
<input type="text" class="input" /> <input type="text" class="container__input" />
<!-- Toggle button sticks to the right --> <!-- Toggle button sticks to the right -->
<button> <button>
@@ -41,7 +41,7 @@ css={`
border: 1px solid rgba(0, 0, 0, 0.3); border: 1px solid rgba(0, 0, 0, 0.3);
} }
.input { .container__input {
border-color: transparent; border-color: transparent;
/* Take available width */ /* Take available width */
flex: 1; flex: 1;

View File

@@ -26,10 +26,10 @@ const Details: React.FC<{}> = () => {
html={` html={`
<div class="container"> <div class="container">
<!-- The real file input --> <!-- The real file input -->
<input type="file" class="input" /> <input type="file" class="container__input" />
<!-- The upload icon --> <!-- The upload icon -->
<div class="icon">...</div> <div class="container__icon">...</div>
<!-- The label --> <!-- The label -->
... ...
@@ -48,7 +48,7 @@ css={`
border: 1px solid rgba(0, 0, 0, 0.3); border: 1px solid rgba(0, 0, 0, 0.3);
} }
.input { .container__input {
/* Take the full size */ /* Take the full size */
height: 100%; height: 100%;
left: 0; left: 0;
@@ -60,7 +60,7 @@ css={`
opacity: 0; opacity: 0;
} }
.icon { .container__icon {
margin-right: 8px margin-right: 8px
} }
`} `}

View File

@@ -25,18 +25,18 @@ const Details: React.FC<{}> = () => {
html={` html={`
<div class="wizard"> <div class="wizard">
<!-- Step --> <!-- Step -->
<div class="step"> <div class="wizard__step">
<div class="step__dot"> <div class="wizard__dot">
<!-- The left connector --> <!-- The left connector -->
<div class="step__connector"></div> <div class="wizard__connector"></div>
<!-- The step number --> <!-- The step number -->
<div class="step__number"> <div class="wizard__number">
... ...
</div> </div>
<!-- The right connector --> <!-- The right connector -->
<div class="step__connector"></div> <div class="wizard__connector"></div>
</div> </div>
<!-- Title of step --> <!-- Title of step -->
@@ -52,30 +52,30 @@ css={`
display: flex; display: flex;
} }
.step { .wizard__step {
/* Make all steps have the same width */ /* Make all steps have the same width */
flex: 1; flex: 1;
} }
.step__dot { .wizard__dot {
/* Center the content */ /* Center the content */
align-items: center; align-items: center;
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.step__connector { .wizard__connector {
flex: 1; flex: 1;
height: 1px; height: 1px;
background-color: rgba(0, 0, 0, .3); background-color: rgba(0, 0, 0, .3);
} }
.step:first-child .step__connector, .wizard__step:first-child .wizard__connector,
.step:last-child .step__connector { .wizard__step:last-child .wizard__connector {
background-color: transparent; background-color: transparent;
} }
.step__number { .wizard__number {
/* Center the content */ /* Center the content */
align-items: center; align-items: center;
display: flex; display: flex;