feat: add column size attribute (#455)
This commit is contained in:
parent
c39eee4368
commit
66d456f552
6 changed files with 51 additions and 10 deletions
|
@ -4,6 +4,14 @@ title: Columns
|
|||
|
||||
The Columns shortcode can be used to organize content side-by-side (horizontally) for better readability.
|
||||
|
||||
## Attributes
|
||||
|
||||
| Name | Description | default |
|
||||
| --------------- | ------------------------------------------------ | ------- |
|
||||
| size (optional) | size of the first column (small\|regular\|large) | regular |
|
||||
|
||||
## Usage
|
||||
|
||||
```html
|
||||
{{</* columns */>}} <!-- begin columns block -->
|
||||
## Left Content
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
--code
|
||||
{{- end }}"
|
||||
href="{{ .Destination | safeURL }}"
|
||||
{{ with .Title }}title="{{ . }}"{{ end }}
|
||||
{{- with .Title }}{{ printf "title=\"%s\"" . | safeHTMLAttr }}{{- end }}
|
||||
>
|
||||
{{- .Text | safeHTML -}}
|
||||
</a>
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
<div class="gdoc-columns flex flex-wrap flex-mobile-column">
|
||||
{{- $size := default "regular" (.Get "size" | lower) }}
|
||||
|
||||
{{- if not (in (slice "regular" "large" "small") $size) }}
|
||||
{{- $size = "regular" }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
<div class="gdoc-columns gdoc-columns--{{ $size }} flex flex-gap flex-mobile-column">
|
||||
{{ range split .Inner "<--->" }}
|
||||
<div class="gdoc-columns__content gdoc-markdown--nested flex-even">
|
||||
{{ . | $.Page.RenderString }}
|
||||
|
|
|
@ -63,6 +63,15 @@
|
|||
|
||||
.flex-mobile-column {
|
||||
flex-direction: column;
|
||||
|
||||
&.gblog-columns {
|
||||
margin: $padding-32 0;
|
||||
}
|
||||
|
||||
.gblog-columns__content {
|
||||
min-width: auto;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#menu-control:checked ~ main {
|
||||
|
|
|
@ -70,16 +70,28 @@
|
|||
|
||||
// {{< columns >}}
|
||||
.gdoc-columns {
|
||||
margin-left: -$padding-16;
|
||||
margin-right: -$padding-16;
|
||||
|
||||
&__content {
|
||||
margin: $padding-16 0;
|
||||
min-width: $body-min-width * 0.66;
|
||||
padding: 0 $padding-16;
|
||||
&--regular > :first-child {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.gdoc-page__anchor {
|
||||
&--small > :first-child {
|
||||
flex: 0.35;
|
||||
min-width: $body-min-width * 0.35;
|
||||
}
|
||||
|
||||
&--large > :first-child {
|
||||
flex: 1.65;
|
||||
min-width: $body-min-width * 1.65;
|
||||
}
|
||||
|
||||
&__content {
|
||||
flex: 1 1;
|
||||
margin: $padding-16 0;
|
||||
min-width: $body-min-width * 0.66;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.gdoc-post__anchor {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,11 @@
|
|||
background: var(--accent-color-lite);
|
||||
}
|
||||
|
||||
.flex-gap {
|
||||
flex-wrap: wrap;
|
||||
gap: $padding-16;
|
||||
}
|
||||
|
||||
.justify-start {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue