woocommerce-blocktheme.scss 8.77 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 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488
/**
* woocommerce-blocktheme.scss
* Block theme default styles to ensure WooCommerce looks better out of the box with block themes that are not optimised for WooCommerce specifically.
*/
@import "fonts";
@import "variables";

/**
* Layout
*/
.woocommerce-cart,
.woocommerce-account,
.woocommerce-checkout {
	.wp-block-post-title,
	main .woocommerce {
		// Allow Cart/Checkout/Account pages more space to breathe.
		max-width: 1000px;
	}
}

.clear {
	clear: both;
}

/**
* General
*/
.woocommerce {

	/**
	* Buttons
	*/
	a.button,
	button[name="add-to-cart"],
	input[name="submit"],
	button.single_add_to_cart_button,
	button[type="submit"]:not(.wp-block-search__button) {
		// Slightly increase CTA size across the board.
		padding: 0.9rem 1.1rem;
	}

	button.button,
	a.button {

		&.disabled,
		&:disabled,
		&:disabled[disabled],
		&.disabled:hover,
		&:disabled:hover,
		&:disabled[disabled]:hover {
			opacity: 0.5;
		}
	}

	#respond input#submit,
	input.button,
	a.button.alt {

		&:hover {
			opacity: 0.9;
		}

		&.disabled,
		&:disabled,
		&:disabled[disabled],
		&.disabled:hover,
		&:disabled:hover,
		&:disabled[disabled]:hover {
			opacity: 0.5;
		}
	}
}

/**
* Products
*/
.woocommerce {
	/**
	* Shop products list
	*/
	ul.products li.product .woocommerce-loop-product__title {
		// Slightly increase font size to make product title more readable.
		font-size: 1.2rem;
	}

	/**
	* Single Product
	*/
	div.product {
		// Ensure the single product contains its content.
		// For details see https://github.com/woocommerce/woocommerce/pull/33511.
		&::after {
			content: "";
			display: block;
			clear: both;
		}

		div.summary > * {
			// Ensure a more even block gap spacing in product summary.
			margin-bottom: var(--wp--style--block-gap);
		}

		.woocommerce-tabs {
			ul.tabs li.active {

				&::before {
					box-shadow: 2px 2px 0 var(--wp--preset--color--background, $contentbg);
				}

				&::after {
					box-shadow: -2px 2px 0 var(--wp--preset--color--background, $contentbg);
				}
			}
		}

		.quantity {
			// Adjust positioning of quantity selector and button.
			.qty {
				margin-right: 0.5rem;
			}

			+ .single_add_to_cart_button {
				min-height: 51px;
			}
		}

		.related.products {
			// Ensure related products doesn't stick to product tabs.
			margin-top: 5rem;
		}
	}

	.woocommerce-Reviews {
		#comments {
			// Add spacing between the review comments and the review form.
			margin-bottom: var(--wp--style--block-gap);
		}

		.commentlist {
			// Ensure review comments width doesn't exceed review container.
			box-sizing: border-box;
		}

		.comment-reply-title {
			// Make review form title visually distinct.
			font-size: var(--wp--preset--font-size--medium);
			font-weight: 700;
		}
	}

	.price ins,
	bdi {
		// Ensure discounted prices aren't underlined.
		// For details see https://github.com/woocommerce/woocommerce-blocks/pull/5684.
		text-decoration: none;
	}

	a.added_to_cart {
		// Prevent "View Cart" button from sticking to "Add to Cart" button.
		// For details see https://github.com/woocommerce/woocommerce-blocks/issues/5285.
		display: block;
		margin-top: 1rem;
	}

	span.onsale {
		// Style "On Sale" badge in theme colors by default.
		background-color: var(--wp--preset--color--foreground, $highlight);
		color: var(--wp--preset--color--background, $highlightext);
	}

	/**
	* Product variations
	*/
	table.variations {
		tr {
			// Limit variation dropdown width and add block gap.
			display: block;
			margin-bottom: var(--wp--style--block-gap);

			th {
				// Ensure variation label doesn't stick to dropdown.
				padding-right: 1rem;
			}

			td select {
				// Add padding to product variation dropdowns.
				height: 3.5rem;
				padding: 0.9rem 1.1rem;
				font-size: var(--wp--preset--font-size--small);
			}
		}
	}

	div.product form.cart table.variations th {
		// Ensure variation label is vertically centered.
		line-height: 3.5rem;
	}
}

/**
* Form elements
*/
.woocommerce-page {
	// Ensure text input fields aren't too small.
	.input-text {
		font-size: var(--wp--preset--font-size--small);
		padding: 0.9rem 1.1rem;
	}

	label {
		margin-bottom: 0.7rem;
	}

	// Ensure dropdowns are visually consistent with other form fields.
	.select2-container {
		.select2-selection,
		.select2-search__field {
			height: 3.5rem;
			font-size: var(--wp--preset--font-size--small);
			padding: 0.9rem 1.1rem;
		}

		.select2-dropdown {
			padding: 0.9rem 1.1rem;

			.select2-search__field {
				margin-bottom: 1rem;
			}
		}

		.select2-selection .select2-selection__arrow {
			position: absolute;
			top: 0;
			right: 0;
			width: 3rem;
			height: 3.5rem;
		}
	}
}

.woocommerce {
	form {
		.form-row {
			margin-bottom: 1rem;
		}

		textarea {
			// Ensure textareas don't look squished.
			min-height: 100px;
		}
	}
}

/**
* Cart / Checkout
*/
.woocommerce-page {
	/**
	* Tables
	*/
	table.shop_table {
		// Adjust table width to new checkout width.
		width: 70%;
		border-collapse: collapse;

		@media only screen and ( max-width: 768px ) {
			width: 100%;
		}

		th,
		td {
			// Allow cells more space to breathe.
			padding: 1rem;
		}
	}

	table.shop_table_responsive {
		// Responsive tables should still take up the full width.
		width: 100%;
	}

	/**
	* Cart specific
	*/
	.woocommerce-cart-form {
		.product-remove {
			// Decrease width of the product remove column.
			width: 1rem;
		}

		.product-thumbnail {
			// Increase product thumbnails to improve visually fidelity.
			width: 120px;

			a img {
				width: 117px;
			}
		}

		#coupon_code {
			// Allow sufficient space for the coupon code.
			width: auto;
			margin-right: 0.8rem;
		}

		#coupon_code,
		.actions .button {
			height: 50px;
			padding: 0.9rem 1.1rem;
			font-size: var(--wp--preset--font-size--small);
		}

		@media only screen and ( max-width: 768px ) {
			.product-remove {
				width: auto;
			}

			#coupon_code {
				width: 50%;
				margin-right: 0;
			}
		}
	}

	.cart-collaterals h2 {
		// Ensure cart subheadline size is reasonable.
		font-size: var(--wp--preset--font-size--medium);
	}

	/**
	* Checkout specific
	*/
	.woocommerce-form-coupon .button {
		min-height: 50px;
	}

	/**
	* Order confirmation
	*/
	.woocommerce-thankyou-order-received,
	h2.woocommerce-column__title {
		font-size: var(--wp--preset--font-size--large);
		font-weight: 300;
	}

	ul.woocommerce-order-overview {
		// Display order overview items next to each other.
		display: flex;
		width: 100%;
		padding-left: 0;
		font-size: var(--wp--preset--font-size--small);

		@media only screen and ( max-width: 768px ) {
			flex-direction: column;
		}

		li {
			flex-grow: 1;
			margin-bottom: 1rem;
			border: none;
		}
	}

	.woocommerce-customer-details address {
		// Ensure customer details match order overview.
		box-sizing: border-box;
		width: 70%;
		padding: 2rem;
		border-width: 1px;
		border-radius: 0;
	}
}

/**
* My account
*/
.woocommerce-account {
	.woocommerce-MyAccount-navigation {
		ul {
			// Ensure top left alignment of the navigation.
			margin: 0 0 2rem;
			padding: 0;
		}

		li {
			// Remove default list styling.
			list-style: none;
			padding: 1rem 0;

			@media only screen and ( max-width: 768px ) {
				padding: 0.35rem 0;
			}

			&:first-child {
				padding-top: 0;
			}

			&.is-active {
				a {
					text-decoration: underline;
				}
			}

			a {
				text-decoration: none;

				&:hover {
					text-decoration: underline;
				}
			}
		}
	}

	.woocommerce-MyAccount-content {
		> p:first-of-type,
		p.form-row-first,
		p.form-row-last {
			// Ensure first paragraph in content is top aligned.
			margin-block-start: 0;
		}
	}

	table.shop_table.order_details,
	.woocommerce-customer-details address {
		// Ensure order/customer details are full width in My Account.
		width: 100%;
	}

	.addresses .title .edit {
		// Align "Add" and "Edit" buttons when title is too long (/my-account/edit-address/).
		display: block;
		margin-bottom: 1rem;
	}

	&.woocommerce-edit-address .woocommerce-MyAccount-content form > h3 {
		// Ensure headline is top aligned (/my-account/edit-address/shipping/).
		margin-block-start: 0;
	}

	.woocommerce-orders-table__cell.woocommerce-orders-table__cell-order-actions {
		a {
			display: block;
			margin-bottom: 1em;
			text-align: center;
		}
	}
}

/**
* My account - Login form
*/
.woocommerce-page {
	.woocommerce-form-login {
		.input-text {
			// Ensure inputs are well spaced.
			font-size: var(--wp--preset--font-size--small);
			padding: 0.9rem 1.1rem;
		}

		label {
			margin-bottom: 0.7rem;
		}

		.show-password-input {
			// Adjust password field icon position.
			top: 0.8rem;
			right: 1.2rem;
		}
	}
}

/**
* Store notice
*/
p.demo_store,
.woocommerce-store-notice {
	// Add theme colors to the store notice.

	background: var(--wp--preset--color--foreground, $primary);
	bottom: 0;
	color: var(--wp--preset--color--background, $primarytext);
	position: fixed;
	top: auto !important;

	a {
		color: var(--wp--preset--color--background, $primarytext);
	}
}