-
Notifications
You must be signed in to change notification settings - Fork 39
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
WIP: Update Tailwind to 3.4 to allow subgrid and update news card to use subgrid as example. #772
Open
dipakmdhrm
wants to merge
2
commits into
main
Choose a base branch
from
subgrid
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4,681 changes: 1,450 additions & 3,231 deletions
4,681
web/themes/custom/server_theme/package-lock.json
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -484,6 +484,17 @@ function server_theme_theme() { | |
], | ||
]; | ||
|
||
$info['server_theme_element__news_card'] = [ | ||
'variables' => [ | ||
'image' => NULL, | ||
'labels' => NULL, | ||
'date' => NULL, | ||
'title' => NULL, | ||
'description' => NULL, | ||
'url' => NULL, | ||
], | ||
]; | ||
|
||
Comment on lines
+487
to
+497
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❌ |
||
// Media document. | ||
$info['server_theme_media__document'] = [ | ||
'variables' => [ | ||
|
11 changes: 11 additions & 0 deletions
11
web/themes/custom/server_theme/templates/node/node--view--news--embed-1.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,11 @@ | ||
{# | ||
/** | ||
* @file | ||
* Theme override to display a news in news grid. | ||
* | ||
* Subgrid requires child grid items inheriting the grid from parent be | ||
* immediate children of the parent grid. This means print the output without | ||
* the Drupal's default node wrapper. | ||
*/ | ||
#} | ||
{{ content }} |
31 changes: 31 additions & 0 deletions
31
web/themes/custom/server_theme/templates/server-theme-element--news-card.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,31 @@ | ||
{# | ||
/** | ||
* @file | ||
* Subgrid card elements. | ||
* | ||
* We have a child and grandchild here, both of which are subgrid elements. | ||
* `grid-rows-subgrid` on both declares that this is a subgrid element. | ||
* | ||
* `row-span-5` on child specifies that each card element will span 5 rows of | ||
* the grid. | ||
* | ||
* <a> wrapper for the image takes the first row. | ||
* | ||
* `row-start-2` and `row-end-6` on grandchild element, which contains label, | ||
* date, title and description, specifies that each of these will span | ||
* row 2 to 5, each auto placed in one row. | ||
*/ | ||
#} | ||
<article class="grid grid-rows-subgrid row-span-5 items-start relative rounded-lg border border-gray-300 w-full h-full overflow-hidden bg-white"> | ||
<a href="{{ url }}"> | ||
<figure class="child-object-cover h-48"> | ||
{{ image }} | ||
</figure> | ||
</a> | ||
<div class="grid grid-rows-subgrid row-start-2 row-end-6 gap-4 md:gap-5 p-4 items-start"> | ||
{{ labels }} | ||
{{ date }} | ||
{{ title }} | ||
{{ description }} | ||
</div> | ||
</article> |
6 changes: 6 additions & 0 deletions
6
web/themes/custom/server_theme/templates/server-theme-news-cards.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,6 @@ | ||
{# 'auto-rows-auto' is important here for auto placement. #} | ||
<div class="grid auto-rows-auto grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-6 gap-y-6 lg:gap-y-8"> | ||
{% for item in items %} | ||
{{ item }} | ||
{% endfor %} | ||
</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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not take this approach. Our approach is in fact the exact opposite. We prefer to break down those twigs, in favor of composing elements -- just like in the existing code.