Skip to content

Commit e7074dc

Browse files
authored
Merge pull request #316 from moderntribe/task/MOOSE-313/accordion-block-styling
[MOOSE-313] FE: Accordion Block
2 parents 123edbc + 922a568 commit e7074dc

File tree

13 files changed

+222
-149
lines changed

13 files changed

+222
-149
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ item (Added, Changed, Depreciated, Removed, Fixed, Security).
88
- Updated: Expected PHP version to v8.4, Node version to v24 LTS
99
- Updated: WordPress to v6.9.1
1010
- Updated: All plugins, composer dependencies, and npm packages to latest versions.
11+
- Added: New Accordion block styling
12+
- Removed: Details block styling
1113

1214
## [2026.01]
1315

wp-content/plugins/core/src/Blocks/Blocks_Definer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
use Tribe\Plugin\Blocks\Filters\Paragraph_Filter;
88
use Tribe\Plugin\Core\Interfaces\Definer_Interface;
99
use Tribe\Theme\bindings\Query_Results_Count;
10+
use Tribe\Theme\blocks\core\accordion\Accordion;
1011
use Tribe\Theme\blocks\core\button\Button;
1112
use Tribe\Theme\blocks\core\column\Column;
1213
use Tribe\Theme\blocks\core\columns\Columns;
13-
use Tribe\Theme\blocks\core\details\Details;
1414
use Tribe\Theme\blocks\core\embed\Embed;
1515
use Tribe\Theme\blocks\core\gallery\Gallery;
1616
use Tribe\Theme\blocks\core\group\Group;
@@ -70,10 +70,10 @@ public function define(): array {
7070
] ),
7171

7272
self::EXTENDED => DI\add( [
73+
DI\get( Accordion::class ),
7374
DI\get( Button::class ),
7475
DI\get( Column::class ),
7576
DI\get( Columns::class ),
76-
DI\get( Details::class ),
7777
DI\get( Embed::class ),
7878
DI\get( Gallery::class ),
7979
DI\get( Group::class ),

wp-content/themes/core/assets/js/theme/blocks/details.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

wp-content/themes/core/assets/js/theme/ready.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ const init = () => {
4444

4545
animateOnScroll();
4646

47-
// conditionally load core/details animation fix
48-
const coreDetailsEls = document.querySelectorAll( '.wp-block-details' );
49-
if ( coreDetailsEls.length > 0 ) {
50-
import(
51-
/* webpackChunkName: "core-details" */ './blocks/details.js'
52-
).then( ( module ) => {
53-
module.default( coreDetailsEls );
54-
} );
55-
}
56-
5747
console.info(
5848
'Theme: Initialized all javascript that targeted document ready.'
5949
);

wp-content/themes/core/assets/pcss/color/_variables.pcss

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
* Borders
5656
* ----------------------------------------------------------------------- */
5757

58-
--color-border: var(--color-neutral-40);
58+
--color-border: var(--color-black);
59+
--color-border-secondary: var(--color-neutral-30);
5960

6061
/* -----------------------------------------------------------------------
6162
* Selection Highlight Color
@@ -85,3 +86,26 @@
8586
--box-shadow-50: var(--wp--preset--shadow--50);
8687
--box-shadow-60: var(--wp--preset--shadow--60);
8788
}
89+
90+
/* -----------------------------------------------------------------------
91+
*
92+
* Dark Themes
93+
*
94+
* ----------------------------------------------------------------------- */
95+
96+
:--dark-themes {
97+
98+
/* -----------------------------------------------------------------------
99+
* Text
100+
* ----------------------------------------------------------------------- */
101+
102+
--color-text: var(--color-white);
103+
--color-text-secondary: var(--color-neutral-20);
104+
105+
/* -----------------------------------------------------------------------
106+
* Borders
107+
* ----------------------------------------------------------------------- */
108+
109+
--color-border: var(--color-white);
110+
--color-border-secondary: var(--color-neutral-20);
111+
}

wp-content/themes/core/assets/pcss/typography/_mixins.pcss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215

216216
@define-mixin t-transparent-underline {
217217
text-decoration-line: underline;
218-
text-decoration-thickness: from-font;
218+
text-decoration-thickness: var(--text-decoration-thickness);
219219
text-decoration-color: transparent;
220220
text-underline-offset: 0.15em;
221221
transition: var(--transition);
@@ -232,13 +232,13 @@
232232
@define-mixin t-animated-underline {
233233
display: inline;
234234
background-image: linear-gradient(currentcolor, currentcolor);
235-
background-size: 0 0.05em;
235+
background-size: 0 var(--text-decoration-thickness);
236236
background-repeat: no-repeat;
237237
background-position: 0 100%;
238238
transition: background-size 0.3s;
239239
text-decoration: none !important; /* override block editor default */
240240
}
241241

242242
@define-mixin t-animated-underline-hover {
243-
background-size: 100% 0.05em;
243+
background-size: 100% var(--text-decoration-thickness);
244244
}

wp-content/themes/core/assets/pcss/typography/_variables.pcss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
--font-weight-regular: var(--wp--custom--font-weight--regular);
3535
--font-weight-bold: var(--wp--custom--font-weight--bold);
3636

37+
/* -------------------------------------------------------------------------
38+
* Text Decoration
39+
* ------------------------------------------------------------------------- */
40+
41+
--text-decoration-thickness: 0.06em;
42+
3743
/* -------------------------------------------------------------------------
3844
* Font Selection
3945
* ------------------------------------------------------------------------- */

wp-content/themes/core/blocks/core/details/Details.php renamed to wp-content/themes/core/blocks/core/accordion/Accordion.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php declare(strict_types=1);
22

3-
namespace Tribe\Theme\blocks\core\details;
3+
namespace Tribe\Theme\blocks\core\accordion;
44

55
use Tribe\Plugin\Blocks\Block_Base;
66

7-
class Details extends Block_Base {
7+
class Accordion extends Block_Base {
88

99
public function get_block_name(): string {
10-
return 'core/details';
10+
return 'core/accordion';
1111
}
1212

1313
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* -------------------------------------------------------------------------
2+
*
3+
* Block - Accordion - Mixins
4+
*
5+
* Because we want to be able to apply the same styles on both hover and
6+
* focus, we use a mixin to avoid code duplication.
7+
*
8+
* ------------------------------------------------------------------------- */
9+
10+
@define-mixin accordion-hover-focus {
11+
12+
.wp-block-accordion-heading__toggle-title {
13+
14+
@mixin t-transparent-underline-hover;
15+
16+
/**
17+
* WP adds text-decoration: underline to the toggle title on hover
18+
* the only value we need to add back is the thickness
19+
* @see https://p.tri.be/i/RF6crT
20+
*/
21+
text-decoration-thickness: var(--text-decoration-thickness);
22+
}
23+
}
File renamed without changes.

0 commit comments

Comments
 (0)