Initial Shopify theme
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
{% doc %}
|
||||
Renders a group of blocks with configurable layout direction, gap and
|
||||
alignment.
|
||||
|
||||
All settings apply to only one dimension to reduce configuration complexity.
|
||||
|
||||
This component is a wrapper concerned only with rendering its children in
|
||||
the specified layout direction with appropriate padding and alignment.
|
||||
|
||||
@example
|
||||
{% content_for 'block', type: 'group', id: 'group' %}
|
||||
{% enddoc %}
|
||||
|
||||
<div
|
||||
class="group {{ block.settings.layout_direction }}"
|
||||
style="
|
||||
--padding: {{ block.settings.padding }}px;
|
||||
--alignment: {{ block.settings.alignment }};
|
||||
"
|
||||
{{ block.shopify_attributes }}
|
||||
>
|
||||
{% content_for 'blocks' %}
|
||||
</div>
|
||||
|
||||
{% stylesheet %}
|
||||
.group {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.group--horizontal {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 var(--padding);
|
||||
}
|
||||
|
||||
.group--vertical {
|
||||
flex-direction: column;
|
||||
align-items: var(--alignment);
|
||||
padding: var(--padding) 0;
|
||||
}
|
||||
{% endstylesheet %}
|
||||
|
||||
{% schema %}
|
||||
{
|
||||
"name": "t:general.group",
|
||||
"blocks": [{ "type": "@theme" }],
|
||||
"settings": [
|
||||
{
|
||||
"type": "select",
|
||||
"id": "layout_direction",
|
||||
"label": "t:labels.layout_direction",
|
||||
"default": "group--vertical",
|
||||
"options": [
|
||||
{ "value": "group--horizontal", "label": "t:options.direction.horizontal" },
|
||||
{ "value": "group--vertical", "label": "t:options.direction.vertical" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"visible_if": "{{ block.settings.layout_direction == 'group--vertical' }}",
|
||||
"type": "select",
|
||||
"id": "alignment",
|
||||
"label": "t:labels.alignment",
|
||||
"default": "flex-start",
|
||||
"options": [
|
||||
{ "value": "flex-start", "label": "t:options.alignment.left" },
|
||||
{ "value": "center", "label": "t:options.alignment.center" },
|
||||
{ "value": "flex-end", "label": "t:options.alignment.right" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "range",
|
||||
"id": "padding",
|
||||
"label": "t:labels.padding",
|
||||
"default": 0,
|
||||
"min": 0,
|
||||
"max": 200,
|
||||
"step": 2,
|
||||
"unit": "px"
|
||||
}
|
||||
],
|
||||
"presets": [
|
||||
{
|
||||
"name": "t:general.column",
|
||||
"category": "t:general.layout",
|
||||
"settings": {
|
||||
"layout_direction": "group--vertical",
|
||||
"alignment": "flex-start",
|
||||
"padding": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "t:general.row",
|
||||
"category": "t:general.layout",
|
||||
"settings": {
|
||||
"layout_direction": "group--horizontal",
|
||||
"padding": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
{% endschema %}
|
||||
@@ -0,0 +1,59 @@
|
||||
{% doc %}
|
||||
Renders a text block.
|
||||
|
||||
@example
|
||||
{% content_for 'block', type: 'text', id: 'text' %}
|
||||
{% enddoc %}
|
||||
|
||||
<div
|
||||
class="text {{ block.settings.text_style }}"
|
||||
style="--text-align: {{ block.settings.alignment }}"
|
||||
{{ block.shopify_attributes }}
|
||||
>
|
||||
{{ block.settings.text }}
|
||||
</div>
|
||||
|
||||
{% stylesheet %}
|
||||
.text {
|
||||
text-align: var(--text-align);
|
||||
}
|
||||
.text--title {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.text--subtitle {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
{% endstylesheet %}
|
||||
|
||||
{% schema %}
|
||||
{
|
||||
"name": "t:general.text",
|
||||
"settings": [
|
||||
{
|
||||
"type": "text",
|
||||
"id": "text",
|
||||
"label": "t:labels.text",
|
||||
"default": "Text"
|
||||
},
|
||||
{
|
||||
"type": "select",
|
||||
"id": "text_style",
|
||||
"label": "t:labels.text_style",
|
||||
"options": [
|
||||
{ "value": "text--title", "label": "t:options.text_style.title" },
|
||||
{ "value": "text--subtitle", "label": "t:options.text_style.subtitle" },
|
||||
{ "value": "text--normal", "label": "t:options.text_style.normal" }
|
||||
],
|
||||
"default": "text--title"
|
||||
},
|
||||
{
|
||||
"type": "text_alignment",
|
||||
"id": "alignment",
|
||||
"label": "t:labels.alignment",
|
||||
"default": "left"
|
||||
}
|
||||
],
|
||||
"presets": [{ "name": "t:general.text" }]
|
||||
}
|
||||
{% endschema %}
|
||||
Reference in New Issue
Block a user