Merge pull request #187 from phuoc-ng/color-swatch
Pattern 100: Color swatch
1
.gitignore
vendored
@@ -3,5 +3,4 @@
|
||||
dist
|
||||
node_modules
|
||||
package-lock.json
|
||||
public/assets/patterns
|
||||
tslint.log
|
||||
@@ -17,6 +17,7 @@ enum Pattern {
|
||||
Chip = 'Chip',
|
||||
CircularNavigation = 'Circular navigation',
|
||||
CloseButton = 'Close button',
|
||||
ColorSwatch = 'Color swatch',
|
||||
CookieBanner = 'Cookie banner',
|
||||
CornerRibbon = 'Corner ribbon',
|
||||
CurvedBackground = 'Curved background',
|
||||
|
||||
@@ -38,7 +38,7 @@ a {
|
||||
/* Layout */
|
||||
.container {
|
||||
margin: 0 auto;
|
||||
max-width: 64rem;
|
||||
max-width: 80rem;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
.content {
|
||||
|
||||
@@ -119,6 +119,7 @@ const ExplorePage = () => {
|
||||
<CoverCard pattern={Pattern.Card} />
|
||||
<CoverCard pattern={Pattern.Centering} />
|
||||
<CoverCard pattern={Pattern.CloseButton} />
|
||||
<CoverCard pattern={Pattern.ColorSwatch} />
|
||||
<CoverCard pattern={Pattern.CookieBanner} />
|
||||
<CoverCard pattern={Pattern.CornerRibbon} />
|
||||
<CoverCard pattern={Pattern.CurvedBackground} />
|
||||
|
||||
@@ -6,13 +6,12 @@
|
||||
.home__features {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin: 2.5rem auto;
|
||||
max-width: 48rem;
|
||||
margin: 1rem -1rem;
|
||||
}
|
||||
.home__feature {
|
||||
padding: 1rem;
|
||||
text-align: center;
|
||||
width: 50%;
|
||||
width: 100%;
|
||||
}
|
||||
.home__icon {
|
||||
color: var(--color-blue-6);
|
||||
@@ -25,7 +24,7 @@
|
||||
}
|
||||
|
||||
.home__patterns {
|
||||
height: 60rem;
|
||||
height: 80rem;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
@@ -63,16 +62,13 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
height: 180rem;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.home__slide {
|
||||
animation: slide 20s linear infinite;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
height: 60rem;
|
||||
justify-content: center;
|
||||
width: 60rem;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
@@ -92,3 +88,15 @@
|
||||
transform: translateY(-100%);
|
||||
}
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (min-width: 640px) {
|
||||
.home__feature {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
.home__feature {
|
||||
width: 33.333333%;
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,7 @@ const Details: React.FC<{}> = () => {
|
||||
<meta name="twitter:description" content="Create an avatar component with CSS flexbox" />
|
||||
<meta name="keywords" content="css avatar, css flexbox" />
|
||||
</Helmet>
|
||||
<div className='p-8 pb-20'>
|
||||
<BrowserFrame
|
||||
<BrowserFrame
|
||||
html={`
|
||||
<div class="avatar">
|
||||
<!-- Avatar image -->
|
||||
@@ -45,48 +44,47 @@ css={`
|
||||
width: 100%;
|
||||
}
|
||||
`}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
height: '100%',
|
||||
justifyContent: 'center',
|
||||
padding: '8px',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
height: '100%',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
||||
borderRadius: '9999px',
|
||||
height: '64px',
|
||||
padding: '8px',
|
||||
width: '64px',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
style={{
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
||||
borderRadius: '9999px',
|
||||
height: '64px',
|
||||
padding: '8px',
|
||||
width: '64px',
|
||||
fill: 'none',
|
||||
height: '100%',
|
||||
stroke: "#FFF",
|
||||
strokeLinecap: 'round',
|
||||
strokeLinejoin: 'round',
|
||||
strokeWidth: 1,
|
||||
width: '100%',
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
style={{
|
||||
fill: 'none',
|
||||
height: '100%',
|
||||
stroke: "#FFF",
|
||||
strokeLinecap: 'round',
|
||||
strokeLinejoin: 'round',
|
||||
strokeWidth: 1,
|
||||
width: '100%',
|
||||
}}
|
||||
>
|
||||
<path
|
||||
d={`M12,3.5c2.347,0,4.25,1.903,4.25,4.25S14.347,12,12,12s-4.25-1.903-4.25-4.25S9.653,3.5,12,3.5z
|
||||
M5,20.5
|
||||
c0-3.866,3.134-7,7-7s7,3.134,7,7H5z`}
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<path
|
||||
d={`M12,3.5c2.347,0,4.25,1.903,4.25,4.25S14.347,12,12,12s-4.25-1.903-4.25-4.25S9.653,3.5,12,3.5z
|
||||
M5,20.5
|
||||
c0-3.866,3.134-7,7-7s7,3.134,7,7H5z`}
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</BrowserFrame>
|
||||
</div>
|
||||
</div>
|
||||
</BrowserFrame>
|
||||
|
||||
<RelatedPatterns patterns={[Pattern.AvatarList, Pattern.InitialAvatar, Pattern.PresenceIndicator]} />
|
||||
</DetailsLayout>
|
||||
|
||||
42
client/patterns/color-swatch/Cover.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* A collection of popular layouts and patterns made with CSS (https://csslayout.io)
|
||||
* (c) 2019 - 2021 Nguyen Huu Phuoc <https://twitter.com/nghuuphuoc>
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
import Frame from '../../placeholders/Frame';
|
||||
|
||||
const Cover: React.FC<{}> = () => {
|
||||
return (
|
||||
<Frame>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
height: '100%',
|
||||
justifyContent: 'center',
|
||||
padding: '8px',
|
||||
}}
|
||||
>
|
||||
{
|
||||
Array(4).fill(0).map((_, index) => (
|
||||
<div
|
||||
key={index}
|
||||
style={{
|
||||
backgroundColor: `rgba(0, 0, 0, 0.${index * 2 + 1})`,
|
||||
borderRadius: '9999px',
|
||||
height: '1.5rem',
|
||||
margin: '0.5rem',
|
||||
width: '1.5rem',
|
||||
}}
|
||||
/>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</Frame>
|
||||
);
|
||||
};
|
||||
|
||||
export default Cover;
|
||||
84
client/patterns/color-swatch/Details.tsx
Normal file
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* A collection of popular layouts and patterns made with CSS (https://csslayout.io)
|
||||
* (c) 2019 - 2021 Nguyen Huu Phuoc <https://twitter.com/nghuuphuoc>
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
import { Helmet } from 'react-helmet';
|
||||
|
||||
import Pattern from '../../constants/Pattern';
|
||||
import DetailsLayout from '../../layouts/DetailsLayout';
|
||||
import BrowserFrame from '../../placeholders/BrowserFrame';
|
||||
|
||||
const Details: React.FC<{}> = () => {
|
||||
return (
|
||||
<DetailsLayout pattern={Pattern.ColorSwatch}>
|
||||
<Helmet>
|
||||
<meta name="description" content="Create a color swatch with CSS flexbox" />
|
||||
<meta name="og:description" content="Create a color swatch with CSS flexbox" />
|
||||
<meta name="twitter:description" content="Create a color swatch with CSS flexbox" />
|
||||
<meta name="keywords" content="css color swatch, css flexbox" />
|
||||
</Helmet>
|
||||
<BrowserFrame
|
||||
html={`
|
||||
<div class="swatch">
|
||||
<div class="swatch__item" style="background-color: ..."></div>
|
||||
|
||||
<!-- Repeat other items -->
|
||||
...
|
||||
</div>
|
||||
`}
|
||||
css={`
|
||||
.swatch {
|
||||
/* Wrap the items */
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.swatch__item {
|
||||
/* Rounded border */
|
||||
border-radius: 9999px;
|
||||
height: 1.5rem;
|
||||
width: 1.5rem;
|
||||
|
||||
/* Space between items */
|
||||
margin: 0.5rem;
|
||||
}
|
||||
`}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
height: '100%',
|
||||
justifyContent: 'center',
|
||||
padding: '0.5rem',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
}}
|
||||
>
|
||||
{
|
||||
Array(9).fill(0).map((_, index) => (
|
||||
<div
|
||||
key={index}
|
||||
style={{
|
||||
backgroundColor: `rgba(0, 0, 0, 0.${index + 1})`,
|
||||
borderRadius: '9999px',
|
||||
height: '1.5rem',
|
||||
margin: '0.5rem',
|
||||
width: '1.5rem',
|
||||
}}
|
||||
/>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</BrowserFrame>
|
||||
</DetailsLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default Details;
|
||||
@@ -9,7 +9,7 @@
|
||||
"deploy": "npm run build && netlify deploy --dir=dist --prod",
|
||||
"analyse": "NODE_ENV=analyse webpack --config webpack.config.js -p",
|
||||
"lint": "tslint -c tslint.json -o tslint.log 'client/**/*.{ts,tsx}'",
|
||||
"screenshot": "rm -rf public/assets/patterns && mkdir public/assets/patterns && TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node bin/generateScreenshots.ts"
|
||||
"screenshot": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node bin/generateScreenshots.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@loadable/component": "^5.14.1",
|
||||
|
||||
BIN
public/assets/patterns/accordion.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
public/assets/patterns/arrow-buttons.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
public/assets/patterns/avatar-list.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
public/assets/patterns/avatar.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
public/assets/patterns/badge.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
public/assets/patterns/breadcrumb.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
public/assets/patterns/button-with-icon.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
public/assets/patterns/card-layout.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
public/assets/patterns/card.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
public/assets/patterns/centering.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
public/assets/patterns/chip.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
public/assets/patterns/circular-navigation.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
public/assets/patterns/close-button.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
public/assets/patterns/color-swatch.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
public/assets/patterns/cookie-banner.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
public/assets/patterns/corner-ribbon.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
public/assets/patterns/curved-background.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
public/assets/patterns/custom-checkbox-button.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
public/assets/patterns/custom-radio-button.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
public/assets/patterns/diagonal-section.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
public/assets/patterns/docked-at-corner.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
public/assets/patterns/dot-leader.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
public/assets/patterns/dot-navigation.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
public/assets/patterns/drawer.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
public/assets/patterns/drop-area.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
public/assets/patterns/drop-cap.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
public/assets/patterns/dropdown.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
public/assets/patterns/fading-long-section.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
public/assets/patterns/feature-comparison.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
public/assets/patterns/feature-list.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
public/assets/patterns/fixed-at-corner.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
public/assets/patterns/fixed-at-side.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/assets/patterns/floating-label.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
public/assets/patterns/folder-structure.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
public/assets/patterns/full-background.png
Normal file
|
After Width: | Height: | Size: 206 KiB |
BIN
public/assets/patterns/full-screen-menu.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
public/assets/patterns/holy-grail.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
public/assets/patterns/initial-avatar.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
public/assets/patterns/input-addon.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
public/assets/patterns/keyboard-shortcut.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
public/assets/patterns/layered-card.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
public/assets/patterns/lined-paper.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
public/assets/patterns/masonry-grid.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
public/assets/patterns/media-object.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
public/assets/patterns/mega-menu.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
public/assets/patterns/menu.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
public/assets/patterns/modal.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
public/assets/patterns/nested-dropdowns.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
public/assets/patterns/notification.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
public/assets/patterns/overlay-play-button.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
public/assets/patterns/pagination.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
public/assets/patterns/popover-arrow.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
public/assets/patterns/presence-indicator.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
public/assets/patterns/previous-next-buttons.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
public/assets/patterns/price-tag.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
public/assets/patterns/pricing-table.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
public/assets/patterns/progress-bar.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
public/assets/patterns/property-list.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
public/assets/patterns/questions-and-answers.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
public/assets/patterns/radial-progress-bar.png
Normal file
|
After Width: | Height: | Size: 69 KiB |
BIN
public/assets/patterns/radio-button-group.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
public/assets/patterns/radio-switch.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
public/assets/patterns/rating.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
public/assets/patterns/resizable-element.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
public/assets/patterns/ribbon.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
public/assets/patterns/same-height-columns.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
public/assets/patterns/search-box.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
public/assets/patterns/separator.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
public/assets/patterns/sidebar.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
public/assets/patterns/simple-grid.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
public/assets/patterns/slider.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
public/assets/patterns/spin-button.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
public/assets/patterns/split-navigation.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
public/assets/patterns/split-screen.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
public/assets/patterns/stacked-cards.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
public/assets/patterns/stamp-border.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
public/assets/patterns/statistic.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
public/assets/patterns/status-light.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
public/assets/patterns/stepper-input.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
public/assets/patterns/sticky-footer.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
public/assets/patterns/sticky-header.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
public/assets/patterns/sticky-sections.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
public/assets/patterns/sticky-table-column.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
public/assets/patterns/sticky-table-headers.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
public/assets/patterns/switch.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
public/assets/patterns/tab.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
public/assets/patterns/teardrop.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
public/assets/patterns/three-dimensions-card.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
public/assets/patterns/timeline.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
public/assets/patterns/toggle-password-visibility.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
public/assets/patterns/tooltip.png
Normal file
|
After Width: | Height: | Size: 49 KiB |