-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathvariations.js
More file actions
159 lines (153 loc) · 8.09 KB
/
variations.js
File metadata and controls
159 lines (153 loc) · 8.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/**
* Internal dependencies
*/
import { i18n, isPro } from 'stackable'
import { substituteIfDisabled } from '~stackable/util'
/**
* WordPress dependencies
*/
import {
__, _x, sprintf,
} from '@wordpress/i18n'
import { applyFilters } from '@wordpress/hooks'
/**
* Internal dependencies
*/
import ImageDefault from './images/default.svg'
import ImagePlain from './images/plain.svg'
import ImageHorizontal from './images/horizontal.svg'
import ImageHorizontal2 from './images/horizontal-2.svg'
import ImageCover from './images/cover.svg'
/**
* Template option choices for predefined columns layouts.
*
* @type {WPBlockVariation[]}
*/ const buttonGroupInnerBlocks = [
[ 'stackable/icon-button', {
icon: '<svg data-prefix="fab" data-icon="facebook-square" class="svg-inline--fa fa-facebook-square fa-w-14" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" aria-hidden="true"><path fill="currentColor" d="M400 32H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h137.25V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.27c-30.81 0-40.42 19.12-40.42 38.73V256h68.78l-11 71.69h-57.78V480H400a48 48 0 0 0 48-48V80a48 48 0 0 0-48-48z"></path></svg>',
buttonBackgroundColor: '#3b5998',
} ],
[ 'stackable/icon-button', {
icon: '<svg data-prefix="fab" data-icon="twitter" class="svg-inline--fa fa-twitter fa-w-16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" aria-hidden="true"><path fill="currentColor" d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path></svg>',
buttonBackgroundColor: '#00acee',
} ],
[
'stackable/icon-button', {
icon: '<svg data-prefix="fab" data-icon="instagram" class="svg-inline--fa fa-instagram fa-w-14" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" aria-hidden="true"><path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg>',
buttonBackgroundColor: '#c13584',
},
],
[
'stackable/icon-button', {
icon: '<svg data-prefix="fab" data-icon="youtube" class="svg-inline--fa fa-youtube fa-w-18" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" aria-hidden="true"><path fill="currentColor" d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"></path></svg>',
buttonBackgroundColor: '#c4302b',
},
],
[
'stackable/icon-button', {
icon: '<svg data-prefix="fab" data-icon="linkedin-in" class="svg-inline--fa fa-linkedin-in fa-w-14" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" aria-hidden="true"><path fill="currentColor" d="M100.28 448H7.4V148.9h92.88zM53.79 108.1C24.09 108.1 0 83.5 0 53.8a53.79 53.79 0 0 1 107.58 0c0 29.7-24.1 54.3-53.79 54.3zM447.9 448h-92.68V302.4c0-34.7-.7-79.2-48.29-79.2-48.29 0-55.69 37.7-55.69 76.7V448h-92.78V148.9h89.08v40.8h1.3c12.4-23.5 42.69-48.3 87.88-48.3 94 0 111.28 61.9 111.28 142.3V448z"></path></svg>',
buttonBackgroundColor: '#0e76a8',
},
],
]
const socialLinksInnerBlocks = [
[ 'core/social-link', { service: 'facebook' } ],
[ 'core/social-link', { service: 'twitter' } ],
[ 'core/social-link', { service: 'instagram' } ],
[ 'core/social-link', { service: 'youtube' } ],
[ 'core/social-link', { service: 'linkedin' } ],
]
const variations = applyFilters(
'stackable.team-member.variations',
[
{
name: 'default',
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Default', i18n ) ),
attributes: {
className: 'is-style-default', hasContainer: true, contentAlign: 'center',
},
isDefault: true,
pickerTitle: __( 'Default', i18n ),
pickerIcon: ImageDefault,
isActive: [ 'className' ],
innerBlocks: [
[ 'stackable/image', {
imageHeight: 150, imageWidth: 150, imageWidthUnit: 'px', imageShape: 'circle',
} ],
[ 'stackable/heading', {
text: __( 'Name', i18n ), textTag: 'h3',
} ],
[ 'stackable/subtitle', {
text: __( 'Position', i18n ),
} ],
[ 'stackable/text', { text: _x( 'Description for this block. Use this space for describing your block. Any text will do. Description for this block. You can use this space for describing your block.', 'Content placeholder', i18n ) } ],
substituteIfDisabled( [ 'stackable/button-group|social-buttons', 'stackable/button-group|icon-button' ],
[ 'stackable/button-group', {}, buttonGroupInnerBlocks ],
[ 'core/social-links', { align: 'center' }, socialLinksInnerBlocks ],
),
],
scope: [ 'block' ],
},
{
name: 'plain',
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Plain', i18n ) ),
attributes: {
className: 'is-style-plain', hasContainer: false, contentAlign: 'left',
},
pickerTitle: __( 'Plain', i18n ),
pickerIcon: ImagePlain,
isActive: [ 'className' ],
innerBlocks: [
[ 'stackable/image', {} ],
[ 'stackable/heading', {
text: __( 'Name', i18n ), textTag: 'h3',
} ],
[ 'stackable/subtitle', {
text: __( 'Position', i18n ),
} ],
substituteIfDisabled( [ 'stackable/button-group|social-buttons', 'stackable/button-group|icon-button' ],
[ 'stackable/button-group', {}, buttonGroupInnerBlocks ],
[ 'core/social-links', { align: 'center' }, socialLinksInnerBlocks ],
),
],
scope: [ 'block' ],
},
{
name: 'horizontal',
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Horizontal', i18n ) ),
attributes: {
className: 'is-style-horizontal',
},
pickerTitle: __( 'Horizontal', i18n ),
pickerIcon: ImageHorizontal,
isActive: [ 'className' ],
isPremium: ! isPro,
scope: [ 'block' ],
},
{
name: 'horizontal-2',
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Horizontal 2', i18n ) ),
attributes: {
className: 'is-style-horizontal-2',
},
pickerTitle: __( 'Horizontal 2', i18n ),
pickerIcon: ImageHorizontal2,
isActive: [ 'className' ],
isPremium: ! isPro,
scope: [ 'block' ],
},
{
name: 'cover',
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Cover', i18n ) ),
attributes: {
className: 'is-style-cover',
},
pickerTitle: __( 'Cover', i18n ),
pickerIcon: ImageCover,
isActive: [ 'className' ],
isPremium: ! isPro,
scope: [ 'block' ],
},
]
)
export default variations