mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-08-08 07:07:15 +02:00
feat: Watermark
This commit is contained in:
8
contents/_includes/patterns/watermark.njk
Normal file
8
contents/_includes/patterns/watermark.njk
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<div class="watermark">
|
||||||
|
<div class="watermark__inner">
|
||||||
|
<div class="watermark__body">
|
||||||
|
Draft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% lines "hor", 5 %}
|
||||||
|
</div>
|
@@ -163,6 +163,12 @@ eleventyExcludeFromCollections: true
|
|||||||
<div class="pattern__title">Initial avatar</div>
|
<div class="pattern__title">Initial avatar</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="pattern__item">
|
||||||
|
<a class="pattern__link" href="/watermark/">
|
||||||
|
<div class="pattern__cover">{% include "patterns/watermark.njk" %}</div>
|
||||||
|
<div class="pattern__title">Watermark</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
68
contents/watermark.md
Normal file
68
contents/watermark.md
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
---
|
||||||
|
layout: layouts/post.njk
|
||||||
|
title: Watermark
|
||||||
|
description: Create a watermark with CSS
|
||||||
|
keywords: css watermark
|
||||||
|
---
|
||||||
|
|
||||||
|
## HTML
|
||||||
|
|
||||||
|
```html
|
||||||
|
<div class="watermark">
|
||||||
|
<!-- Watermark container -->
|
||||||
|
<div class="watermark__inner">
|
||||||
|
<!-- The watermark -->
|
||||||
|
<div class="watermark__body">
|
||||||
|
Draft
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Other content -->
|
||||||
|
...
|
||||||
|
</div>
|
||||||
|
```
|
||||||
|
|
||||||
|
## CSS
|
||||||
|
|
||||||
|
```css
|
||||||
|
.watermark {
|
||||||
|
/* Used to position the watermark */
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.watermark__inner {
|
||||||
|
/* Center the content */
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
/* Absolute position */
|
||||||
|
left: 0px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
|
||||||
|
/* Take full size */
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.watermark__body {
|
||||||
|
/* Text color */
|
||||||
|
color: rgba(0, 0, 0, 0.2);
|
||||||
|
|
||||||
|
/* Text styles */
|
||||||
|
font-size: 3rem;
|
||||||
|
font-weight: bold;
|
||||||
|
text-transform: uppercase;
|
||||||
|
|
||||||
|
/* Rotate the text */
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
|
||||||
|
/* Disable the selection */
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{% demo %}
|
||||||
|
{% include "patterns/watermark.njk" %}
|
||||||
|
{% enddemo %}
|
@@ -1,134 +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 (
|
|
||||||
<PatternLayout pattern={Pattern.Watermark}>
|
|
||||||
<Head>
|
|
||||||
<meta name="description" content="Create a watermark with CSS" />
|
|
||||||
<meta name="og:description" content="Create a watermark with CSS" />
|
|
||||||
<meta name="twitter:description" content="Create a watermark with CSS" />
|
|
||||||
<meta name="keywords" content="css watermark" />
|
|
||||||
</Head>
|
|
||||||
<BrowserFrame
|
|
||||||
html={`
|
|
||||||
<div class="container">
|
|
||||||
<!-- Watermark container -->
|
|
||||||
<div class="container__wrapper">
|
|
||||||
<!-- The watermark -->
|
|
||||||
<div class="container__watermark">
|
|
||||||
Draft
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Other content -->
|
|
||||||
...
|
|
||||||
</div>
|
|
||||||
`}
|
|
||||||
css={`
|
|
||||||
.container {
|
|
||||||
/* Used to position the watermark */
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container__wrapper {
|
|
||||||
/* Center the content */
|
|
||||||
align-items: center;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
|
|
||||||
/* Absolute position */
|
|
||||||
left: 0px;
|
|
||||||
position: absolute;
|
|
||||||
top: 0px;
|
|
||||||
|
|
||||||
/* Take full size */
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container__watermark {
|
|
||||||
/* Text color */
|
|
||||||
color: rgba(0, 0, 0, 0.2);
|
|
||||||
|
|
||||||
/* Text styles */
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: bold;
|
|
||||||
text-transform: uppercase;
|
|
||||||
|
|
||||||
/* Rotate the text */
|
|
||||||
transform: rotate(-45deg);
|
|
||||||
|
|
||||||
/* Disable the selection */
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
`}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
alignItems: 'center',
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column',
|
|
||||||
height: '100%',
|
|
||||||
justifyContent: 'center',
|
|
||||||
padding: '8px',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
border: '1px solid rgba(0, 0, 0, 0.3)',
|
|
||||||
padding: '16px',
|
|
||||||
position: 'relative',
|
|
||||||
width: '300px',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
alignItems: 'center',
|
|
||||||
display: 'flex',
|
|
||||||
height: '100%',
|
|
||||||
justifyContent: 'center',
|
|
||||||
left: 0,
|
|
||||||
position: 'absolute',
|
|
||||||
top: 0,
|
|
||||||
width: '100%',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
color: 'rgba(0, 0, 0, 0.2)',
|
|
||||||
fontSize: '3rem',
|
|
||||||
fontWeight: 'bold',
|
|
||||||
textTransform: 'uppercase',
|
|
||||||
transform: 'rotate(-45deg)',
|
|
||||||
userSelect: 'none',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Draft
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style={{ marginBottom: '8px' }}>
|
|
||||||
<Block numberOfBlocks={20} />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style={{ marginBottom: '8px' }}>
|
|
||||||
<Block numberOfBlocks={15} />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style={{ marginBottom: '8px' }}>
|
|
||||||
<Block numberOfBlocks={10} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</BrowserFrame>
|
|
||||||
</PatternLayout>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Details;
|
|
@@ -1,33 +0,0 @@
|
|||||||
import * as React from 'react';
|
|
||||||
|
|
||||||
import Frame from '../../placeholders/Frame';
|
|
||||||
|
|
||||||
const Cover: React.FC<{}> = () => {
|
|
||||||
return (
|
|
||||||
<Frame>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
alignItems: 'center',
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column',
|
|
||||||
height: '100%',
|
|
||||||
justifyContent: 'center',
|
|
||||||
padding: '8px',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
color: 'rgba(0, 0, 0, 0.3)',
|
|
||||||
fontWeight: 'bold',
|
|
||||||
textTransform: 'uppercase',
|
|
||||||
transform: 'rotate(-45deg)',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Draft
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Frame>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Cover;
|
|
@@ -36,6 +36,7 @@
|
|||||||
@import './patterns/fixed-at-side';
|
@import './patterns/fixed-at-side';
|
||||||
@import './patterns/full-background';
|
@import './patterns/full-background';
|
||||||
@import './patterns/initial-avatar';
|
@import './patterns/initial-avatar';
|
||||||
|
@import './patterns/watermark';
|
||||||
|
|
||||||
// Placeholders
|
// Placeholders
|
||||||
@import './placeholders/circle';
|
@import './placeholders/circle';
|
||||||
|
42
styles/patterns/_watermark.scss
Normal file
42
styles/patterns/_watermark.scss
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
.watermark {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
/* Demo */
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.watermark__inner {
|
||||||
|
/* Center the content */
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
/* Absolute position */
|
||||||
|
left: 0px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
|
||||||
|
/* Take full size */
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.watermark__body {
|
||||||
|
/* Text color */
|
||||||
|
color: rgba(0, 0, 0, 0.2);
|
||||||
|
|
||||||
|
/* Text styles */
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: bold;
|
||||||
|
text-transform: uppercase;
|
||||||
|
|
||||||
|
/* Rotate the text */
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
|
||||||
|
/* Disable the selection */
|
||||||
|
user-select: none;
|
||||||
|
}
|
Reference in New Issue
Block a user