summaryrefslogtreecommitdiff
blob: 7663d70c1c5294f50b2b846de07d9ebcd51fbfa5 (plain)
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
@import './view.scss';
@import './variables.scss';
@import '../../shared/styles/gutenberg-colors.scss';

// inspired by from assets/shared/_animations loading-fade
@keyframes tiled-gallery-img-placeholder {
	0% {
		background-color: var( --color-neutral-0 );
	}
	50% {
		background-color: rgba( var( --color-neutral-0-rgb ), 0.5 );
	}
	100% {
		background-color: var( --color-neutral-0 );
	}
}

.wp-block-jetpack-tiled-gallery {
	// Ensure that selected image outlines are visibile
	padding-left: 4px;
	padding-right: 4px;

	&.is-style-square,
	&.is-style-circle {
		.tiled-gallery__item.is-transient img {
			// Transient images (no src attribute) occupy no vertical space.
			// If on a row by themself, the row is hidden.
			// By setting the bottom margin, ensure they occupy the correct vertical space.
			margin-bottom: 100%;
		}
	}

	.tiled-gallery__item {
		// Hide the focus outline that otherwise briefly appears when selecting a block.
		> img:focus {
			outline: none;
		}

		> img {
			// Inspired by Calypso's placeholder mixin
			animation: tiled-gallery-img-placeholder 1.6s ease-in-out infinite;
		}

		&.is-selected {
			outline: 4px solid $tiled-gallery-selection;

			// Disable filters when selected
			filter: none;
			&::before,
			&::after {
				content: none;
			}
		}

		&.is-transient {
			height: 100%;
			width: 100%;
			img {
				background-position: center;
				background-size: cover;
				height: 100%;
				opacity: 0.3;
				width: 100%;
			}
		}
	}

	.tiled-gallery__add-item {
		margin-top: $tiled-gallery-gutter;
		width: 100%;

		.components-form-file-upload,
		.components-button.tiled-gallery__add-item-button {
			width: 100%;
			height: 100%;
		}

		.components-button.tiled-gallery__add-item-button {
			display: flex;
			flex-direction: column;
			justify-content: center;
			box-shadow: none;
			border: none;
			border-radius: 0;
			min-height: 100px;

			.dashicon {
				margin-top: 10px;
			}

			&:hover,
			&:focus {
				border: 1px solid $dark-gray-500;
			}
		}
	}

	.tiled-gallery__item__inline-menu {
		background-color: $tiled-gallery-selection;
		display: inline-flex;
		padding: 0 0 2px 2px;
		position: absolute;
		right: 0;
		top: 0;

		.components-button {
			color: var( --color-white );
			&:hover,
			&:focus {
				color: var( --color-white );
			}
		}
	}

	.tiled-gallery__item__remove {
		padding: 0;
	}

	.tiled-gallery__item .components-spinner {
		position: absolute;
		top: 50%;
		left: 50%;
		margin: 0;
		transform: translate( -50%, -50% );
	}

	// Hide upload buttons in style picker preview
	.editor-block-preview__content & {
		.editor-media-placeholder {
			display: none;
		}
	}
}

.tiled-gallery__filter-picker-menu {
	$active-item-outline-width: 2px;
	padding: 7px;

	// Leave space between elements for active state styling
	.components-menu-item__button + .components-menu-item__button {
		margin-top: $active-item-outline-width;
	}

	.components-menu-item__button.is-active {
		color: $dark-gray-900;
		box-shadow: 0 0 0 $active-item-outline-width $dark-gray-500 !important;
	}
}