8000 initial commit of template/css for newsroom teasers by markconroy · Pull Request #250 · localgovdrupal/localgov_base · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

initial commit of template/css for newsroom teasers #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions css/components/newsroom-teaser.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.newsroom-teaser > * + * {
margin-top: var(--vertical-rhythm-spacing);
}
3 changes: 3 additions & 0 deletions css/components/newsroom-teaser.ie11.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.newsroom-teaser > * + * {
margin-top: 1.5rem;
}
6 changes: 6 additions & 0 deletions < 8000 a title="localgov_base.libraries.yml" class="Link--primary Truncate-text" href="#diff-ac0c4cbe047128eda247b5515c909c8bc9deaf67cac7c0eba11ed6c7016fa8dd">localgov_base.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ featured-teasers:
css/components/featured-teasers.ie11.css: {}
css/components/featured-teasers.css: {}

newsroom-teaser:
css:
theme:
css/components/newsroom-teaser.ie11.css: {}
css/components/newsroom-teaser.css: {}

tabs:
css:
theme:
Expand Down
73 changes: 73 additions & 0 deletions templates/paragraphs/paragraph--localgov-newsroom-teaser.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{#
/**
* @file
* Default theme implementation to display a Newsroom teaser paragraph.
*
* Available variables:
* - paragraph: Full paragraph entity.
* Only method names starting with "get", "has", or "is" and a few common
* methods such as "id", "label", and "bundle" are available. For example:
* - paragraph.getCreatedTime() will return the paragraph creation timestamp.
* - paragraph.id(): The paragraph ID.
* - paragraph.bundle(): The type of the paragraph, for example, "image" or "text".
* - paragraph.getOwnerId(): The user ID of the paragraph author.
* See Drupal\paragraphs\Entity\Paragraph for a full list of public properties
* and methods for the paragraph object.
* - content: All paragraph items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
* {{ content|without('field_example') }} to temporarily suppress the printing
* of a given child element.
* - attributes: HTML attributes for the containing element.
* The attributes.class element may contain one or more of the following
* classes:
* - paragraphs: The current template type (also known as a "theming hook").
* - paragraphs--type-[type]: The current paragraphs type. For example, if the paragraph is an
* "Image" it would result in "paragraphs--type--image". Note that the machine
* name will often be in a short form of the human readable label.
* - paragraphs--view-mode--[view_mode]: The View Mode of the paragraph; for example, a
* preview would result in: "paragraphs--view-mode--preview", and
* default: "paragraphs--view-mode--default".
* - view_mode: View mode; for example, "preview" or "full".
* - logged_in: Flag for authenticated user status. Will be true when the
* current user is a logged-in member.
* - is_admin: Flag for admin user status. Will be true when the current user
* is an administrator.
*
* @see template_preprocess_paragraph()
*
* @ingroup themeable
*/
#}

{% set classes = [
'newsroom-teaser',
paragraph.localgov_newsroom_teaser_image.value ? 'newsroom-teaser--has-image' : 'newsroom-teaser--no-image',
]
%}

{% if not localgov_base_remove_css %}
{{ attach_library('localgov_base/newsroom-teaser') }}
{% endif %}

<article{{ attributes.addClass(classes)}}>
{% if paragraph.localgov_newsroom_teaser_image.value %}
<div class="newsroom-teaser__image">
{{ content.localgov_newsroom_teaser_image }}
</div>
{% endif %}

{% if paragraph.localgov_newsroom_teaser_title.value %}
<h3 class="newsroom-teaser__title">
<a href="{{ link }}">
{{ content.localgov_newsroom_teaser_title }}
</a>
</h3>
{% endif %}

{% if paragraph.localgov_newsroom_teaser_summary.value %}
<div class="newsroom-teaser__summary">
{{ content.localgov_newsroom_teaser_summary }}
</div>
{% endif %}

</article>
0