mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-08-09 23:57:08 +02:00
feat: Status light
This commit is contained in:
6
contents/_includes/patterns/status-light.njk
Normal file
6
contents/_includes/patterns/status-light.njk
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<div class="status-light">
|
||||||
|
<div class="status-light__status"></div>
|
||||||
|
<div class="status-light__content">
|
||||||
|
{% rectangle "hor", "sm", 100 %}
|
||||||
|
</div>
|
||||||
|
</div>
|
@@ -253,6 +253,12 @@ eleventyExcludeFromCollections: true
|
|||||||
<div class="pattern__title">Statistic</div>
|
<div class="pattern__title">Statistic</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pattern__item">
|
||||||
|
<a class="pattern__link" href="/status-light/">
|
||||||
|
<div class="pattern__cover">{% include "patterns/status-light.njk" %}</div>
|
||||||
|
<div class="pattern__title">Status light</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
<div class="pattern__item">
|
<div class="pattern__item">
|
||||||
<a class="pattern__link" href="/video-background/">
|
<a class="pattern__link" href="/video-background/">
|
||||||
<div class="pattern__cover">{% include "patterns/video-background.njk" %}</div>
|
<div class="pattern__cover">{% include "patterns/video-background.njk" %}</div>
|
||||||
|
54
contents/status-light.md
Normal file
54
contents/status-light.md
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
layout: layouts/post.njk
|
||||||
|
title: Status light
|
||||||
|
description: Create a status light with CSS flexbox
|
||||||
|
keywords: css flexbox, css status light
|
||||||
|
---
|
||||||
|
|
||||||
|
## HTML
|
||||||
|
|
||||||
|
```html
|
||||||
|
<div class="status-light">
|
||||||
|
<!-- Status light -->
|
||||||
|
<div class="status-light__status"></div>
|
||||||
|
|
||||||
|
<!-- Content -->
|
||||||
|
<div class="status-light__content">
|
||||||
|
...
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
```
|
||||||
|
|
||||||
|
## CSS
|
||||||
|
|
||||||
|
```css
|
||||||
|
.status-light {
|
||||||
|
/* Center the content */
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-light__status {
|
||||||
|
/* Background color */
|
||||||
|
background-color: #16a34a;
|
||||||
|
|
||||||
|
/* Rounded border */
|
||||||
|
border-radius: 9999px;
|
||||||
|
|
||||||
|
/* Size */
|
||||||
|
height: 0.5rem;
|
||||||
|
width: 0.5rem;
|
||||||
|
|
||||||
|
/* Spacing */
|
||||||
|
margin-right: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-light__content {
|
||||||
|
/* Take available width */
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{% demo %}
|
||||||
|
{% include "patterns/status-light.njk" %}
|
||||||
|
{% enddemo %}
|
@@ -11,49 +11,17 @@ const Details: React.FC<{}> = () => {
|
|||||||
return (
|
return (
|
||||||
<PatternLayout pattern={Pattern.StatusLight}>
|
<PatternLayout pattern={Pattern.StatusLight}>
|
||||||
<Head>
|
<Head>
|
||||||
<meta name="description" content="Create a status light with CSS flexbox" />
|
<meta name="description" content="" />
|
||||||
<meta name="og:description" content="Create a status light with CSS flexbox" />
|
<meta name="og:description" content="Create a status light with CSS flexbox" />
|
||||||
<meta name="twitter:description" content="Create a status light with CSS flexbox" />
|
<meta name="twitter:description" content="Create a status light with CSS flexbox" />
|
||||||
<meta name="keywords" content="css flexbox, css status light" />
|
<meta name="keywords" content="" />
|
||||||
</Head>
|
</Head>
|
||||||
<BrowserFrame
|
<BrowserFrame
|
||||||
html={`
|
html={`
|
||||||
<div class="container">
|
|
||||||
<!-- Status light -->
|
|
||||||
<div class="container__status"></div>
|
|
||||||
|
|
||||||
<!-- Content -->
|
|
||||||
<div class="container__content">
|
|
||||||
...
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`}
|
`}
|
||||||
css={`
|
css={`
|
||||||
.container {
|
|
||||||
/* Center the content */
|
|
||||||
align-items: center;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container__status {
|
|
||||||
/* Background color */
|
|
||||||
background-color: rgb(66, 153, 225);
|
|
||||||
|
|
||||||
/* Rounded border */
|
|
||||||
border-radius: 9999px;
|
|
||||||
|
|
||||||
/* Size */
|
|
||||||
height: 8px;
|
|
||||||
width: 8px;
|
|
||||||
|
|
||||||
/* Spacing */
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container__content {
|
|
||||||
/* Take available width */
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
@@ -1,46 +0,0 @@
|
|||||||
import * as React from 'react';
|
|
||||||
|
|
||||||
import Frame from '../../placeholders/Frame';
|
|
||||||
import Rectangle from '../../placeholders/Rectangle';
|
|
||||||
|
|
||||||
const Cover: React.FC<{}> = () => {
|
|
||||||
return (
|
|
||||||
<Frame>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
alignItems: 'center',
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column',
|
|
||||||
height: '100%',
|
|
||||||
justifyContent: 'center',
|
|
||||||
padding: '8px',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
alignItems: 'center',
|
|
||||||
display: 'flex',
|
|
||||||
justifyContent: 'center',
|
|
||||||
width: '75%',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
backgroundColor: '#4299e1',
|
|
||||||
borderRadius: '9999px',
|
|
||||||
height: '8px',
|
|
||||||
marginRight: '8px',
|
|
||||||
width: '8px',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div style={{ flex: 1 }}>
|
|
||||||
<Rectangle />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Frame>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Cover;
|
|
@@ -51,6 +51,7 @@
|
|||||||
@import './patterns/stacked-cards';
|
@import './patterns/stacked-cards';
|
||||||
@import './patterns/stamp-border';
|
@import './patterns/stamp-border';
|
||||||
@import './patterns/statistic';
|
@import './patterns/statistic';
|
||||||
|
@import './patterns/status-light';
|
||||||
@import './patterns/triangle-buttons';
|
@import './patterns/triangle-buttons';
|
||||||
@import './patterns/video-background';
|
@import './patterns/video-background';
|
||||||
@import './patterns/voting';
|
@import './patterns/voting';
|
||||||
|
28
styles/patterns/_status-light.scss
Normal file
28
styles/patterns/_status-light.scss
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
.status-light {
|
||||||
|
/* Center the content */
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
/* Demo */
|
||||||
|
width: 8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-light__status {
|
||||||
|
/* Background color */
|
||||||
|
background-color: #16a34a;
|
||||||
|
|
||||||
|
/* Rounded border */
|
||||||
|
border-radius: 9999px;
|
||||||
|
|
||||||
|
/* Size */
|
||||||
|
height: 0.5rem;
|
||||||
|
width: 0.5rem;
|
||||||
|
|
||||||
|
/* Spacing */
|
||||||
|
margin-right: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-light__content {
|
||||||
|
/* Take available width */
|
||||||
|
flex: 1;
|
||||||
|
}
|
Reference in New Issue
Block a user