-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(shs-5906): icon logic, templates and styles for social media foo…
…ter block (#1673)
- Loading branch information
Showing
5 changed files
with
243 additions
and
19 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
29 changes: 11 additions & 18 deletions
29
docroot/modules/humsci/hs_blocks/templates/block--social-media.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 |
---|---|---|
@@ -1,19 +1,12 @@ | ||
Icon size: {{ (icon_size) }} | ||
<br> | ||
Layout: {{ layout }} | ||
<br> | ||
{% if links %} | ||
<ul> | ||
{% for link in links %} | ||
<li> | ||
<a href="{{ link.link_url }}"> | ||
{% if link.link_title %} | ||
{{ link.link_title }} | ||
{% else %} | ||
{{ link.link_url }} | ||
{% endif %} | ||
</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
<ul class="social-media-link__list"> | ||
{% for link in links %} | ||
<li> | ||
<a href="{{ link.link_url }}" class="social-media-link" title="{{ link.link_title }}"> | ||
<i class="social-media-link__icon {{ link.icon_classes }}"></i> | ||
<span class="social-media-link__label">{{ link.link_title }}</span> | ||
</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} |
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
70 changes: 70 additions & 0 deletions
70
docroot/themes/humsci/humsci_basic/src/scss/components/_block-social-media-footer.scss
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,70 @@ | ||
.block-social-media-footer { | ||
ul { | ||
@include hb-list-empty-styles; | ||
} | ||
|
||
li { | ||
display: flex; | ||
} | ||
|
||
.social-media-link { | ||
text-decoration: none; | ||
display: flex; | ||
align-items: center; | ||
flex-grow: 1; | ||
} | ||
|
||
.social-media-link__icon { | ||
width: 1em; | ||
text-align: center; | ||
|
||
// Override for Soundcloud icon (too wide). | ||
&.fa-soundcloud { | ||
font-size: 0.73em; | ||
width: 1.37em; | ||
} | ||
} | ||
} | ||
|
||
// Grid Layout. | ||
.block-social-media-footer--layout-grid { | ||
ul { | ||
display: grid; | ||
gap: hb-calculate-rems(16px); | ||
grid-template-columns: repeat(4, 1fr); | ||
} | ||
|
||
.social-media-link__label { | ||
@include visually-hidden; | ||
} | ||
} | ||
|
||
// Vertical List Layout. | ||
.block-social-media-footer--layout-vertical-list { | ||
li { | ||
margin-bottom: hb-calculate-rems(16px); | ||
} | ||
|
||
.social-media-link { | ||
gap: hb-calculate-rems(16px); | ||
} | ||
|
||
.social-media-link__label { | ||
font-size: hb-calculate-rems(16px); | ||
text-decoration: underline; | ||
} | ||
} | ||
|
||
// Small icons. | ||
.block-social-media-footer--icons-small { | ||
.social-media-link { | ||
font-size: hb-calculate-rems(32px); | ||
} | ||
} | ||
|
||
// Large icons. | ||
.block-social-media-footer--icons-large { | ||
.social-media-link { | ||
font-size: hb-calculate-rems(48px); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
.../themes/humsci/humsci_basic/templates/block/block--hs-blocks-social-media-block.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,47 @@ | ||
{# | ||
/** | ||
* @file | ||
* Default theme implementation to display a block. | ||
* | ||
* Available variables: | ||
* - plugin_id: The ID of the block implementation. | ||
* - label: The configured label of the block if visible. | ||
* - configuration: A list of the block's configuration values. | ||
* - label: The configured label for the block. | ||
* - label_display: The display settings for the label. | ||
* - provider: The module or other provider that provided this block plugin. | ||
* - Block plugin specific settings will also be stored here. | ||
* - in_preview: Whether the plugin is being rendered in preview mode. | ||
* - content: The content of this block. | ||
* - attributes: array of HTML attributes populated by modules, intended to | ||
* be added to the main container tag of this template. | ||
* - id: A valid HTML ID and guaranteed unique. | ||
* - title_attributes: Same as attributes, except applied to the main title | ||
* tag that appears in the template. | ||
* - title_prefix: Additional output populated by modules, intended to be | ||
* displayed in front of the main title tag that appears in the template. | ||
* - title_suffix: Additional output populated by modules, intended to be | ||
* displayed after the main title tag that appears in the template. | ||
* | ||
* @see template_preprocess_block() | ||
* | ||
* @ingroup themeable | ||
*/ | ||
#} | ||
{% set base_class = 'block-social-media-footer' %} | ||
{% set classes = [ | ||
base_class, | ||
base_class ~ '--layout-' ~ content['#layout']|clean_class, | ||
base_class ~ '--icons-' ~ content['#icon_size']|clean_class, | ||
] %} | ||
|
||
<div{{ attributes.addClass(classes) }}> | ||
{{ title_prefix }} | ||
{% if label %} | ||
<h2{{ title_attributes.addClass('block__title') }}>{{ label }}</h2> | ||
{% endif %} | ||
{{ title_suffix }} | ||
{% block content %} | ||
{{ content }} | ||
{% endblock %} | ||
</div> |