Skip to content

Commit 796cfba

Browse files
committed
Add container
1 parent 1648742 commit 796cfba

File tree

9 files changed

+194
-231
lines changed

9 files changed

+194
-231
lines changed

docs/assets/styles/code-previews.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
background-color: rgb(var(--zn-panel));
1616
min-width: 20rem;
1717
max-width: 100%;
18-
padding: 1.5rem 3.25rem 1.5rem 1.5rem;
18+
/*padding: 1.5rem 3.25rem 1.5rem 1.5rem;*/
19+
padding-right: 1.75rem;
1920
}
2021

2122
/* Block the preview while dragging to prevent iframes from intercepting drag events */

docs/assets/styles/docs.css

Lines changed: 4 additions & 229 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
--docs-border-color: rgb(var(--zn-border-color));
55
--docs-border-width: 1px;
66
--docs-border-radius: 10px;
7-
--docs-content-max-width: 860px;
7+
--docs-content-max-width: 1400px;
88
--docs-sidebar-width: 320px;
99
--docs-sidebar-transition-speed: 250ms;
1010
--docs-content-toc-max-width: 260px;
@@ -1094,141 +1094,6 @@ html.sidebar-open #menu-toggle {
10941094
margin-bottom: var(--docs-content-vertical-spacing);
10951095
}
10961096

1097-
/* Print styles */
1098-
@media print {
1099-
a:not(.anchor-heading)[href]::after {
1100-
content: ' (' attr(href) ')';
1101-
}
1102-
1103-
details,
1104-
pre,
1105-
.callout {
1106-
border: solid var(--docs-border-width) var(--docs-border-color);
1107-
}
1108-
1109-
details summary {
1110-
list-style: none;
1111-
}
1112-
1113-
details summary span {
1114-
padding-left: 0;
1115-
}
1116-
1117-
details summary::marker,
1118-
details summary::-webkit-details-marker {
1119-
display: none;
1120-
}
1121-
1122-
.callout::before {
1123-
border: solid var(--docs-border-width) var(--docs-border-color);
1124-
}
1125-
1126-
.component-page__navigation,
1127-
.copy-code-button,
1128-
.code-preview__buttons,
1129-
.code-preview__resizer {
1130-
display: none !important;
1131-
}
1132-
1133-
.flavor-html .code-preview__source--html,
1134-
.flavor-react .code-preview__source--react {
1135-
display: block !important;
1136-
}
1137-
1138-
.flavor-html .code-preview__source--html > pre,
1139-
.flavor-react .code-preview__source--react > pre {
1140-
border: none;
1141-
}
1142-
1143-
.code-preview__source-group {
1144-
border-bottom: solid 1px var(--zn-color-neutral-200);
1145-
border-bottom-left-radius: var(--zn-border-radius-medium);
1146-
border-bottom-right-radius: var(--zn-border-radius-medium);
1147-
}
1148-
1149-
#sidebar {
1150-
display: none;
1151-
}
1152-
1153-
#content {
1154-
margin-left: 0;
1155-
}
1156-
1157-
#menu-toggle,
1158-
#icon-toolbar,
1159-
.external-link__icon {
1160-
display: none;
1161-
}
1162-
}
1163-
1164-
/* Splash */
1165-
1166-
.splash {
1167-
display: flex;
1168-
padding-top: 2rem;
1169-
}
1170-
1171-
.splash-start {
1172-
min-width: 420px;
1173-
}
1174-
1175-
.splash-start h1 {
1176-
font-size: var(--zn-font-size-large);
1177-
font-weight: var(--zn-font-weight-normal);
1178-
}
1179-
1180-
.splash li img {
1181-
width: 1em;
1182-
height: 1em;
1183-
vertical-align: -2px;
1184-
}
1185-
1186-
.splash-end {
1187-
display: flex;
1188-
align-items: flex-end;
1189-
width: auto;
1190-
padding-left: 1rem;
1191-
}
1192-
1193-
.splash-image {
1194-
width: 100%;
1195-
height: auto;
1196-
}
1197-
1198-
.splash-logo {
1199-
max-width: 22rem;
1200-
}
1201-
1202-
.splash-start h1:first-of-type {
1203-
font-size: var(--zn-font-size-large);
1204-
margin: 0 0 0.5rem 0;
1205-
}
1206-
1207-
@media screen and (max-width: 1280px) {
1208-
.splash {
1209-
display: block;
1210-
}
1211-
1212-
.splash-start {
1213-
min-width: 0;
1214-
padding-bottom: 1rem;
1215-
}
1216-
1217-
.splash-end {
1218-
padding: 0;
1219-
}
1220-
1221-
.splash-image {
1222-
display: block;
1223-
max-width: 400px;
1224-
}
1225-
1226-
/* Shields */
1227-
.splash + p {
1228-
margin-top: 2rem;
1229-
}
1230-
}
1231-
12321097
/* Component headers */
12331098

12341099
.component-header h1 {
@@ -1294,97 +1159,7 @@ body[data-page^='/tokens/'] .table-wrapper td:first-child code {
12941159
white-space: nowrap;
12951160
}
12961161

1297-
/* Border radius demo */
1298-
1299-
.border-radius-demo {
1300-
width: 3rem;
1301-
height: 3rem;
1302-
background: var(--zn-color-primary-600);
1303-
}
1304-
1305-
/* Transition demo */
1306-
1307-
.transition-demo {
1308-
position: relative;
1309-
background: var(--zn-color-neutral-200);
1310-
width: 8rem;
1311-
height: 2rem;
1312-
}
1313-
1314-
.transition-demo:after {
1315-
content: '';
1316-
position: absolute;
1317-
background-color: var(--zn-color-primary-600);
1318-
top: 0;
1319-
left: 0;
1320-
width: 0;
1321-
height: 100%;
1322-
transition-duration: inherit;
1323-
transition-property: width;
1324-
}
1325-
1326-
.transition-demo:hover:after {
1327-
width: 100%;
1328-
}
1329-
1330-
/* Spacing demo */
1331-
1332-
.spacing-demo {
1333-
width: 100px;
1334-
background: var(--zn-color-primary-600);
1335-
}
1336-
1337-
/* Elevation demo */
1338-
1339-
.elevation-demo {
1340-
background: transparent;
1341-
border-radius: 3px;
1342-
width: 4rem;
1343-
height: 4rem;
1344-
margin: 1rem;
1345-
}
1346-
1347-
/* Color palettes */
1348-
1349-
.color-palette {
1350-
display: grid;
1351-
grid-template-columns: 200px repeat(11, 1fr);
1352-
gap: 1rem var(--zn-spacing-2x-small);
1353-
margin: 2rem 0;
1354-
}
1355-
1356-
.color-palette__name {
1357-
font-size: var(--zn-font-size-medium);
1358-
font-weight: var(--zn-font-weight-semibold);
1359-
grid-template-columns: repeat(11, 1fr);
1360-
}
1361-
1362-
.color-palette__name code {
1363-
background: none;
1364-
font-size: var(--zn-font-size-x-small);
1365-
}
1366-
1367-
.color-palette__example {
1368-
font-size: var(--zn-font-size-x-small);
1369-
text-align: center;
1370-
}
1371-
1372-
.color-palette__swatch {
1373-
height: 3rem;
1374-
border-radius: var(--zn-border-radius-small);
1162+
/** Container Demo */
1163+
zn-container::part(base) {
1164+
background-color: var(--zn-color-primary-300);
13751165
}
1376-
1377-
.color-palette__swatch--border {
1378-
box-shadow: inset 0 0 0 1px var(--zn-color-neutral-300);
1379-
}
1380-
1381-
@media screen and (max-width: 1200px) {
1382-
.color-palette {
1383-
grid-template-columns: repeat(6, 1fr);
1384-
}
1385-
1386-
.color-palette__name {
1387-
grid-column-start: span 6;
1388-
}
1389-
}
1390-

docs/pages/components/container.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
meta:
3+
title: Container
4+
description:
5+
layout: component
6+
---
7+
8+
```html:preview
9+
10+
<zn-container>
11+
<div
12+
style="position:relative; height: 16rem; overflow: hidden; border: 1px dashed rgb(229, 231, 235); opacity: 0.75;">
13+
<svg fill="none"
14+
style="position: absolute; inset: 0; width: 100%; height: 100%; background-color: rgb(255, 255, 255); stroke: rgba(0, 0, 0, 0.1);">
15+
<defs>
16+
<pattern id="pattern-2e2e2dfb-58b7-4019-82fc-58ca045f95ff" x="0" y="0" width="10" height="10"
17+
patternUnits="userSpaceOnUse">
18+
<path d="M-3 13 15-5M-5 5l18-18M-1 21 17 3"></path>
19+
</pattern>
20+
</defs>
21+
<rect stroke="none" fill="url(#pattern-2e2e2dfb-58b7-4019-82fc-58ca045f95ff)" width="100%" height="100%"></rect>
22+
</svg>
23+
</div>
24+
</zn-container>
25+
```
26+
27+
## Examples
28+
29+
### Padded Container
30+
31+
```html:preview
32+
<zn-container padded>
33+
<div
34+
style="position:relative; height: 16rem; overflow: hidden; border: 1px dashed rgb(229, 231, 235); opacity: 0.75;">
35+
<svg fill="none"
36+
style="position: absolute; inset: 0; width: 100%; height: 100%; background-color: rgb(255, 255, 255); stroke: rgba(0, 0, 0, 0.1);">
37+
<defs>
38+
<pattern id="pattern-2e2e2dfb-58b7-4019-82fc-58ca045f95ff" x="0" y="0" width="10" height="10"
39+
patternUnits="userSpaceOnUse">
40+
<path d="M-3 13 15-5M-5 5l18-18M-1 21 17 3"></path>
41+
</pattern>
42+
</defs>
43+
<rect stroke="none" fill="url(#pattern-2e2e2dfb-58b7-4019-82fc-58ca045f95ff)" width="100%" height="100%"></rect>
44+
</svg>
45+
</div>
46+
</zn-container>
47+
```
48+
49+
### Breakpoint Container
50+
51+
```html:preview
52+
<zn-container breakpoint>
53+
<div
54+
style="position:relative; height: 16rem; overflow: hidden; border: 1px dashed rgb(229, 231, 235); opacity: 0.75;">
55+
<svg fill="none"
56+
style="position: absolute; inset: 0; width: 100%; height: 100%; background-color: rgb(255, 255, 255); stroke: rgba(0, 0, 0, 0.1);">
57+
<defs>
58+
<pattern id="pattern-2e2e2dfb-58b7-4019-82fc-58ca045f95ff" x="0" y="0" width="10" height="10"
59+
patternUnits="userSpaceOnUse">
60+
<path d="M-3 13 15-5M-5 5l18-18M-1 21 17 3"></path>
61+
</pattern>
62+
</defs>
63+
<rect stroke="none" fill="url(#pattern-2e2e2dfb-58b7-4019-82fc-58ca045f95ff)" width="100%" height="100%"></rect>
64+
</svg>
65+
</div>
66+
</zn-container>
67+
```
68+
69+
### Padded Breakpoint Container
70+
71+
```html:preview
72+
<zn-container padded breakpoint>
73+
<div
74+
style="position:relative; height: 16rem; overflow: hidden; border: 1px dashed rgb(229, 231, 235); opacity: 0.75;">
75+
<svg fill="none"
76+
style="position: absolute; inset: 0; width: 100%; height: 100%; background-color: rgb(255, 255, 255); stroke: rgba(0, 0, 0, 0.1);">
77+
<defs>
78+
<pattern id="pattern-2e2e2dfb-58b7-4019-82fc-58ca045f95ff" x="0" y="0" width="10" height="10"
79+
patternUnits="userSpaceOnUse">
80+
<path d="M-3 13 15-5M-5 5l18-18M-1 21 17 3"></path>
81+
</pattern>
82+
</defs>
83+
<rect stroke="none" fill="url(#pattern-2e2e2dfb-58b7-4019-82fc-58ca045f95ff)" width="100%" height="100%"></rect>
84+
</svg>
85+
</div>
86+
</zn-container>
87+
```
88+
89+
TODO
90+
91+
[component-metadata:zn-container]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import {classMap} from "lit/directives/class-map.js";
2+
import {type CSSResultGroup, html, unsafeCSS} from 'lit';
3+
import {property} from 'lit/decorators.js';
4+
import ZincElement from '../../internal/zinc-element';
5+
6+
import styles from './container.scss';
7+
8+
/**
9+
* @summary Layout container, used to wrap content with optional padding and breakpoint width.
10+
* @documentation https://zinc.style/components/container
11+
* @status experimental
12+
* @since 1.0
13+
*
14+
* @slot - The default slot.
15+
*
16+
* @csspart base - The component's base wrapper.
17+
*/
18+
export default class ZnContainer extends ZincElement {
19+
static styles: CSSResultGroup = unsafeCSS(styles);
20+
21+
@property({type: Boolean}) padded: boolean;
22+
@property({type: Boolean}) breakpoint: boolean;
23+
24+
render() {
25+
return html`
26+
<div part="base" class=${classMap({
27+
'container': true,
28+
'container--padded': this.padded,
29+
'container--breakpoint': this.breakpoint,
30+
})}>
31+
<slot></slot>
32+
</div>`;
33+
}
34+
}

0 commit comments

Comments
 (0)