-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tw29613664 - add unpublished indicator (#64)
Co-authored-by: Jay Darnell <“jay.darnell@gmail.com”>
- Loading branch information
1 parent
dad990f
commit cf9354b
Showing
3 changed files
with
109 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@mixin unpublished-page { | ||
background-color: #fff4f4; | ||
|
||
&:before { | ||
content: "- UNPUBLISHED -"; | ||
display: block; | ||
text-align: center; | ||
font-size: 1.3333rem; | ||
padding: 1rem 0; | ||
margin: 0; | ||
font-family: var(--bold-font-family); | ||
font-weight: 300; | ||
line-height: 1.3; | ||
background-color: transparent; | ||
} | ||
} | ||
|
||
@mixin unpublished-component { | ||
@include unpublished-page; | ||
|
||
&:before { | ||
font-size: 1rem; | ||
padding: .5rem 0; | ||
line-height: 1; | ||
} | ||
} | ||
|
||
.node--unpublished { | ||
@include unpublished-page; | ||
} | ||
|
||
.paragraph--unpublished { | ||
@include unpublished-component; | ||
} |
59 changes: 59 additions & 0 deletions
59
templates/overrides/patterns/accordion_item/pattern-accordion-item.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{% set entity = context.getProperty('entity') %} | ||
{% set entity_type = context.getProperty('entity_type') %} | ||
|
||
{% set item_id = item_id|default("accordion-item-" ~ random()) %} | ||
|
||
{% set heading_level = heading_level|default(2) %} | ||
{% | ||
set button_attributes = create_attribute({ | ||
'class': [ | ||
'accordion-button', | ||
'collapsed' | ||
], | ||
'type': 'button', | ||
'data-bs-toggle': 'collapse', | ||
'data-bs-target': '#' ~ item_id, | ||
'aria-controls': item_id, | ||
'aria-expanded': 'false' | ||
}) | ||
%} | ||
|
||
{% | ||
set content_attributes = create_attribute({ | ||
'id': item_id, | ||
'class': [ | ||
'accordion-collapse', | ||
'collapse', | ||
'js-accordion-keep-open' | ||
], | ||
'aria-labelledby': 'heading--' ~ item_id | ||
}) | ||
%} | ||
|
||
{% if opened %} | ||
{% set button_attributes = button_attributes.setAttribute('aria-expanded', 'true') %} | ||
{% set button_attributes = button_attributes.removeClass('collapsed') %} | ||
{% set content_attributes = content_attributes.addClass('show') %} | ||
{% endif %} | ||
|
||
{% | ||
set classes = [ | ||
'accordion-item', | ||
entity_type ? entity_type, | ||
not entity.isPublished() ? entity_type ~ '--unpublished', | ||
] | ||
%} | ||
|
||
<div{{attributes.addClass(classes)}}> | ||
<h{{heading_level}} class="accordion-header" id="heading--{{ item_id }}"> | ||
<button{{button_attributes}}> | ||
{{ title }} | ||
</button> | ||
</h{{heading_level}}> | ||
<div{{content_attributes}}> | ||
<div class="accordion-body"> | ||
{{ content }} | ||
</div> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters