mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-08-11 08:34:27 +02:00
feat: Previous next buttons
This commit is contained in:
8
contents/_includes/covers/previous-next-buttons.njk
Normal file
8
contents/_includes/covers/previous-next-buttons.njk
Normal file
@@ -0,0 +1,8 @@
|
||||
<div class="previous-next-buttons">
|
||||
<div class="previous-next-buttons__nav">
|
||||
<div class="previous-next-buttons__button previous-next-buttons__button--l"></div>
|
||||
</div>
|
||||
<div class="previous-next-buttons__nav">
|
||||
<div class="previous-next-buttons__button previous-next-buttons__button--r"></div>
|
||||
</div>
|
||||
</div>
|
@@ -131,6 +131,7 @@ eleventyExcludeFromCollections: true
|
||||
{% pattern "Drawer" %}{% include "covers/drawer.njk" %}{% endpattern %}
|
||||
{% pattern "Menu" %}{% include "covers/menu.njk" %}{% endpattern %}
|
||||
{% pattern "Pagination" %}{% include "covers/pagination.njk" %}{% endpattern %}
|
||||
{% pattern "Previous next buttons" %}{% include "covers/previous-next-buttons.njk" %}{% endpattern %}
|
||||
{% pattern "Tab" %}{% include "covers/tab.njk" %}{% endpattern %}
|
||||
{% pattern "Wizard" %}{% include "covers/wizard.njk" %}{% endpattern %}
|
||||
</div>
|
||||
|
36
contents/previous-next-buttons.md
Normal file
36
contents/previous-next-buttons.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
layout: layouts/post.njk
|
||||
title: Previous next buttons
|
||||
description: Create previous and next buttons with CSS flexbox
|
||||
keywords: css flexbox, css pagination
|
||||
---
|
||||
|
||||
## HTML
|
||||
|
||||
```html
|
||||
<div class="previous-next-buttons">
|
||||
<!-- Previous link sticks to the left -->
|
||||
<div class="previous-next-buttons__nav">
|
||||
<a class="previous-next-buttons__button previous-next-buttons__button--l"></a>
|
||||
</div>
|
||||
|
||||
<!-- Next link sticks to the right -->
|
||||
<div class="previous-next-buttons__nav">
|
||||
<a class="previous-next-buttons__button previous-next-buttons__button--r"></a>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
## CSS
|
||||
|
||||
```css
|
||||
.previous-next-buttons {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
```
|
||||
|
||||
You can use the [arrow buttons](/arrow-buttons/) to create the previous and next buttons.
|
||||
|
||||
{% demo %}{% include "covers/previous-next-buttons.njk" %}{% enddemo %}
|
@@ -1,91 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import Head from 'next/head';
|
||||
import { Pattern } from '../../constants/Pattern';
|
||||
|
||||
import { PatternLayout } from '../../layouts/PatternLayout';
|
||||
import BrowserFrame from '../../placeholders/BrowserFrame';
|
||||
import Rectangle from '../../placeholders/Rectangle';
|
||||
|
||||
const Details: React.FC<{}> = () => {
|
||||
return (
|
||||
<PatternLayout pattern={Pattern.PreviousNextButtons}>
|
||||
<Head>
|
||||
<meta name="description" content="Create previous and next buttons with CSS flexbox" />
|
||||
<meta name="og:description" content="Create previous and next buttons with CSS flexbox" />
|
||||
<meta name="twitter:description" content="Create previous and next buttons with CSS flexbox" />
|
||||
<meta name="keywords" content="css flexbox, css pagination" />
|
||||
</Head>
|
||||
<BrowserFrame
|
||||
html={`
|
||||
<div class="container">
|
||||
<!-- Previous link sticks to the left -->
|
||||
<a>..</a>
|
||||
|
||||
<!-- Next link sticks to the right -->
|
||||
<a>..</a>
|
||||
</div>
|
||||
`}
|
||||
css={`
|
||||
.container {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
`}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
height: '100%',
|
||||
justifyContent: 'center',
|
||||
padding: '8px',
|
||||
}}
|
||||
>
|
||||
<div style={{ width: '50%' }}>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
height: '32px',
|
||||
justifyContent: 'space-between',
|
||||
padding: '8px',
|
||||
width: '100%',
|
||||
}}
|
||||
>
|
||||
<a
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
border: '1px solid #d1d5db',
|
||||
borderRadius: '4px',
|
||||
display: 'flex',
|
||||
padding: '8px',
|
||||
width: '30%',
|
||||
}}
|
||||
>
|
||||
<div style={{ marginRight: '8px' }}><</div>
|
||||
<Rectangle />
|
||||
</a>
|
||||
<a
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
border: '1px solid #d1d5db',
|
||||
borderRadius: '4px',
|
||||
display: 'flex',
|
||||
padding: '8px',
|
||||
width: '30%',
|
||||
}}
|
||||
>
|
||||
<Rectangle />
|
||||
<div style={{ marginLeft: '8px' }}>></div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</BrowserFrame>
|
||||
</PatternLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default Details;
|
@@ -1,50 +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={{
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
width: '100%',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
border: '1px solid #d1d5db',
|
||||
borderRadius: '4px',
|
||||
padding: '4px 8px',
|
||||
}}
|
||||
>
|
||||
<
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
border: '1px solid #d1d5db',
|
||||
borderRadius: '4px',
|
||||
padding: '4px 8px',
|
||||
}}
|
||||
>
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Frame>
|
||||
);
|
||||
};
|
||||
|
||||
export default Cover;
|
@@ -62,6 +62,7 @@
|
||||
@import './patterns/pagination';
|
||||
@import './patterns/popover-arrow';
|
||||
@import './patterns/presence-indicator';
|
||||
@import './patterns/previous-next-buttons';
|
||||
@import './patterns/price-tag';
|
||||
@import './patterns/pricing-table';
|
||||
@import './patterns/progress-bar';
|
||||
|
47
styles/patterns/_previous-next-buttons.scss
Normal file
47
styles/patterns/_previous-next-buttons.scss
Normal file
@@ -0,0 +1,47 @@
|
||||
.previous-next-buttons {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
/* Demo */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.previous-next-buttons__nav {
|
||||
position: relative;
|
||||
|
||||
/* Demo */
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.25rem 0.5rem;
|
||||
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
height: 2rem;
|
||||
width: 3rem;
|
||||
}
|
||||
|
||||
.previous-next-buttons__button {
|
||||
/* Transparent background */
|
||||
background-color: transparent;
|
||||
|
||||
/* Size */
|
||||
height: 0.5rem;
|
||||
width: 0.5rem;
|
||||
}
|
||||
|
||||
.previous-next-buttons__button--r {
|
||||
/* Edges */
|
||||
border-right: 1px solid #d1d5db;
|
||||
border-top: 1px solid #d1d5db;
|
||||
transform: translateX(-25%) rotate(45deg);
|
||||
}
|
||||
|
||||
.previous-next-buttons__button--l {
|
||||
/* Edges */
|
||||
border-bottom: 1px solid #d1d5db;
|
||||
border-left: 1px solid #d1d5db;
|
||||
transform: translateX(25%) rotate(45deg);
|
||||
}
|
Reference in New Issue
Block a user