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

WIP: Listing variations by content type #462

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

davisagli
Copy link
Member

Opening a draft PR so I can put notes on things I want to discuss...

What's included here:

  • Re-label the built-in listing variations to List (was Default), List with images (was Summary), and Grid.
  • Add a new Summary component which is looked up by content type and renders the kicker, title, and description
  • CSS tweaks to make the kicker look correct where it was not shown before
  • Add Summary component implementations for News Item and Event to show the dates next to the kicker

To do:

  • i18n for the new variation labels
  • docs on how to customize content summaries

{item?.head_title && <div className="headline">{item.head_title}</div>}
<HeadingTag className="title">
{item.title ? item.title : item.id}
</HeadingTag>
Copy link
Member Author

Choose a reason for hiding this comment

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

This keeps the same tag that was used before (h2 or h3) for backwards compatibility, but ideally we would not use those tags, since this isn't part of the page outline (table of contents).

const { item, HeadingTag = 'h3' } = props;
return (
<>
{item?.head_title && <div className="headline">{item.head_title}</div>}
Copy link
Member Author

Choose a reason for hiding this comment

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

I really wish we could switch this class to use kicker instead of headline, especially since headline is also used for the heading at the top of the listing block.

);
};

export default NewsItemSummary;
Copy link
Member Author

Choose a reason for hiding this comment

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

There's quite a bit repeated between the default summary and the custom ones for News Item and Event -- when really we are only changing the kicker. Should we be adding a Kicker component instead?

On the other hand, doing it this way makes it possible to show something entirely different than the title + description if that makes more sense for some content type.

config.getComponent({
name: 'Summary',
dependencies: [item['@type']],
}).component || DefaultSummary;
Copy link
Member Author

Choose a reason for hiding this comment

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

Does using a component in the registry just make it harder to explain than updating an object in config.settings (i.e. like contentTypeViews)?

year: 'numeric',
month: 'long',
day: 'numeric',
});
Copy link
Member Author

Choose a reason for hiding this comment

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

We ought to update the FormattedDate component in volto to use this instead of momentjs, but that'll have to be in a major version...

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.

1 participant