Skip to content
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

OEL-1159: Align search variant with default card pattern #178

Merged
merged 26 commits into from
Apr 6, 2022

Conversation

donquixote
Copy link
Contributor

Jira issue(s):

@donquixote donquixote force-pushed the OEL-1159-card-pattern-search-variant branch 2 times, most recently from a08173e to ab81793 Compare February 9, 2022 21:48
@donquixote donquixote force-pushed the OEL-1159-card-pattern-search-variant branch from ab81793 to 0034c57 Compare March 17, 2022 17:09
@@ -10,47 +10,81 @@ card:
description: 'Card with special behaviour for print search results items.'
fields:
orientation:
# Full type: `'horizontal'|'vertical'`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have any comment. Please remove them.

preview: 'Title card'
url:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not agree with the url field. We already have the title field. I don't feel comfortable with two fields for the same when we are trying to keep the patterns as simple as possible.

Also If anybody needs a link then they maybe want to customise, a custom class, title, etc. And with url you loose this possibility you have with the title field. Maybe if instead url it was a link pattern and then print the link in the template, it would have more sense. But IMHO with title field is enough for cover this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok to see it removed.
The motivation was that calling code should not have to set the 'underline-hover' class on the link.
But ok for me to remove.

Comment on lines 5 to 14
*
* Differences to main variant:
* - Always use horizontal layout, with specific classes.
* - Add extra classes on card body (right column), to prevent padding.
* This should probably be handled by BCL if horizontal is used.
* - Use text color dark.
* - Set different margin-bottom for text element.
* - Set special parameters on the image.
* - Add special wrapper attributes.
* - Ignore 'subtitle', 'date', 'card_header', 'card_footer'.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really need this? Please remove.

type: text
label: 'Card footer'
description: 'Card footer content.'
preview: 'Footer of card'
badges:
# Full type: `list<array{label: string|render|markup, ..}>`.
# See 'bcl-badge.html.twig'.
type: array
label: 'Badges'
description: 'List of badges for the card.'
Copy link
Contributor

@escuriola escuriola Mar 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The badges label are primary and secondary but has the same aspect, so I would change the label or add the badge style to the badges.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused by the wording of this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good now.

'subtitle': subtitle,
'text': text,
'tag': 'div',
} : {},
'content': content,
'image': image,
'card_header': header,
'card_footer': footer,
'badges': badges,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default badges has set the outline to true.

Comment on lines 48 to 53
'date': (date is not empty) ? {
'day': date|date('d'),
'month': date|date('M'),
'year': date|date('Y'),
'date_time': date|date('Y-m-d'),
} : {},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove date until full date ticket is prepared.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice that date is not even declared in the pattern definition.
I kept it there because it existed in the current version of the template.
But I agree to remove it.

@@ -35,6 +35,15 @@ card:
preview:
path: 'https://placeimg.com/1000/500/people'
alt: 'Alternative text for card image'
meta:
# Full type: `list<text|render|markup>`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove comments

@donquixote donquixote force-pushed the OEL-1159-card-pattern-search-variant branch from e892485 to 97dfdfd Compare March 21, 2022 12:56
escuriola
escuriola previously approved these changes Mar 21, 2022
Copy link
Contributor

@brummbar brummbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor remarks.

@@ -5,58 +5,54 @@
*/
#}
{% spaceless %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's take the chance to replace these with {% apply spaceless %} as this one used above is deprecated already.

{% endfor %}
{% endif %}
{% include '@oe-bcl/card' with {
horizontal: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the other template we quote the keys, in here we don't. We should stick to one, I believe we went for always quote.

brummbar
brummbar previously approved these changes Apr 1, 2022
escuriola
escuriola previously approved these changes Apr 4, 2022
@donquixote
Copy link
Contributor Author

This will break whitelabel and showcase.
Let's not merge before the demo!

@escuriola escuriola dismissed stale reviews from brummbar and themself via dd75b38 April 5, 2022 10:55
@escuriola escuriola force-pushed the OEL-1159-card-pattern-search-variant branch from 63fea3a to dd75b38 Compare April 5, 2022 10:55
@donquixote donquixote force-pushed the OEL-1159-card-pattern-search-variant branch from c4db4bb to 453ff3c Compare April 5, 2022 19:31
The parameter was not declared in the pattern definition.
A new date parameter might be introduced in the future.
Changes:
- Make 'rounded_pill: true, outline: true' the default for all badges in cards.
  This is the most common way badges are shown in cards.
- Preserve custom settings when merging defaults.
- Expose the full signature of bcl-badge in the badge parameter.
  (this was previously not the case for search variant)
- Have 3 badges in the preview, to show different options.
@donquixote donquixote force-pushed the OEL-1159-card-pattern-search-variant branch from 453ff3c to 4870149 Compare April 6, 2022 12:25
content: content
} only %}
{% endspaceless %}
<div>{{ content }}</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the compulsory div intentional ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see below.

{% endfor %}
</div>
{% endif %}
<div>{{ content }}</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the compulsory div intentional ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @brummbar mentioned we should wrap this in a div. I don't have a strong opinion on it myself.
In earlier versions of the theme, the idea was that "content" is like a general-purpose variable where developers can put additional stuff that is not already handled with other variables. so it would support more than one element, and these elements would already have their own wrappers.

This said: If we do keep the div, we need to check first that the content is not empty.

So we can either drop the div, or check emptiness first.

'text': (text is not empty) ? {
'content': text,
'classes': 'mb-2-5',
'tag': 'div',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why div ? it was p before, I see p in netlify..

Copy link
Contributor Author

@donquixote donquixote Apr 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to support formatted text which may already contain <p> tags.
Then the <div> is just an additional wrapper.

{% apply spaceless %}
{% set content %}
{% if meta is not empty %}
{# Use negative margin to compensate for me-3 on each item. #}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets remember to revisit this with BCL 0.21

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok but not now, right?

It turns out that 'content is empty' is not sufficient, because e.g. ['#markup' => ''] won't be determined as empty.
Also, 'content|render' does not behave as desired, if content is already a Markup object.
@donquixote donquixote force-pushed the OEL-1159-card-pattern-search-variant branch from 9f84037 to 1dc402a Compare April 6, 2022 14:20
@donquixote donquixote merged commit d66d1f2 into 1.x Apr 6, 2022
@donquixote donquixote deleted the OEL-1159-card-pattern-search-variant branch April 6, 2022 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants