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

Add VCollectionHeader component #2734

Merged
merged 12 commits into from Aug 28, 2023
Merged

Add VCollectionHeader component #2734

merged 12 commits into from Aug 28, 2023

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Jul 27, 2023

Fixes

Fixes #2729 by @obulat

Description

This PR adds the component that displays the collection icon, its title, external link (if available) and the number of results in the collection.

This component is not used anywhere yet, so you can only see it in the Storybook.

Testing Instructions

Check out the rendered Story. It should match the Figma designs ( creator desktop and mobile, source desktop and mobile, tag desktop and mobile).

Clicking on the external link button sends an analytics event, but since the build is "production", you cannot see the event details logged in the console, only the warning that Plausible was disabled.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@obulat obulat self-assigned this Jul 27, 2023
@obulat obulat force-pushed the add/VCollectionHeader_component branch from 382f654 to f19d4e1 Compare July 27, 2023 06:45
@github-actions github-actions bot added 🧱 stack: documentation Related to Sphinx documentation 🧱 stack: frontend Related to the Nuxt frontend labels Jul 27, 2023
@openverse-bot openverse-bot added 🟨 priority: medium Not blocking but should be addressed soon 🌟 goal: addition Addition of new feature 🕹 aspect: interface Concerns end-users' experience with the software labels Jul 27, 2023
@github-actions
Copy link

github-actions bot commented Jul 27, 2023

Size Change: +3.19 kB (0%)

Total Size: 878 kB

Filename Size Change
./frontend/.nuxt/dist/client/236.js 0 B -273 B (removed) 🏆
./frontend/.nuxt/dist/client/236.modern.js 0 B -277 B (removed) 🏆
./frontend/.nuxt/dist/client/237.js 273 B -1.58 kB (-85%) 🏆
./frontend/.nuxt/dist/client/app.js 123 kB +136 B (0%)
./frontend/.nuxt/dist/client/app.modern.js 114 kB +138 B (0%)
./frontend/.nuxt/dist/client/components/v-sources-table.js 14.5 kB +116 B (+1%)
./frontend/.nuxt/dist/client/components/v-sources-table.modern.js 14.6 kB +119 B (+1%)
./frontend/.nuxt/dist/client/pages/image/_id/index.js 8.14 kB +17 B (0%)
./frontend/.nuxt/dist/client/pages/image/_id/index.modern.js 7.96 kB +18 B (0%)
./frontend/.nuxt/dist/client/237.modern.js 277 B +277 B (new file) 🆕
./frontend/.nuxt/dist/client/238.js 1.85 kB +1.85 kB (new file) 🆕
./frontend/.nuxt/dist/client/components/v-collection-header.js 1.31 kB +1.31 kB (new file) 🆕
./frontend/.nuxt/dist/client/components/v-collection-header.modern.js 1.31 kB +1.31 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
./frontend/.nuxt/dist/client/commons/app.js 90.5 kB 0 B
./frontend/.nuxt/dist/client/commons/app.modern.js 81.1 kB 0 B
./frontend/.nuxt/dist/client/commons/components/v-external-search-form/components/v-external-source-list/components/v-no-results/2c6cc095.js 5.18 kB 0 B
./frontend/.nuxt/dist/client/commons/components/v-external-search-form/components/v-external-source-list/components/v-no-results/2c6cc095.modern.js 5.62 kB -2 B (0%)
./frontend/.nuxt/dist/client/components/loading-icon.js 729 B +1 B (0%)
./frontend/.nuxt/dist/client/components/loading-icon.modern.js 734 B 0 B
./frontend/.nuxt/dist/client/components/table-sort-icon.js 515 B 0 B
./frontend/.nuxt/dist/client/components/table-sort-icon.modern.js 519 B 0 B
./frontend/.nuxt/dist/client/components/v-all-results-grid.js 6.62 kB +2 B (0%)
./frontend/.nuxt/dist/client/components/v-all-results-grid.modern.js 6.46 kB +1 B (0%)
./frontend/.nuxt/dist/client/components/v-audio-collection.js 4.39 kB 0 B
./frontend/.nuxt/dist/client/components/v-audio-collection.modern.js 4.27 kB 0 B
./frontend/.nuxt/dist/client/components/v-audio-details.js 1.79 kB -1 B (0%)
./frontend/.nuxt/dist/client/components/v-audio-details.modern.js 1.77 kB 0 B
./frontend/.nuxt/dist/client/components/v-audio-list.js 1.32 kB 0 B
./frontend/.nuxt/dist/client/components/v-audio-list.modern.js 1.31 kB 0 B
./frontend/.nuxt/dist/client/components/v-audio-result.js 1 kB 0 B
./frontend/.nuxt/dist/client/components/v-audio-result.modern.js 995 B 0 B
./frontend/.nuxt/dist/client/components/v-audio-track-skeleton.js 956 B 0 B
./frontend/.nuxt/dist/client/components/v-audio-track-skeleton.modern.js 960 B 0 B
./frontend/.nuxt/dist/client/components/v-audio-track.js 5.67 kB +1 B (0%)
./frontend/.nuxt/dist/client/components/v-audio-track.modern.js 5.63 kB +3 B (0%)
./frontend/.nuxt/dist/client/components/v-back-to-search-results-link.js 634 B 0 B
./frontend/.nuxt/dist/client/components/v-back-to-search-results-link.modern.js 643 B 0 B
./frontend/.nuxt/dist/client/components/v-bone.js 632 B 0 B
./frontend/.nuxt/dist/client/components/v-bone.modern.js 636 B 0 B
./frontend/.nuxt/dist/client/components/v-box-layout.js 1.33 kB 0 B
./frontend/.nuxt/dist/client/components/v-box-layout.modern.js 1.33 kB 0 B
./frontend/.nuxt/dist/client/components/v-content-link.js 1.06 kB 0 B
./frontend/.nuxt/dist/client/components/v-content-link.modern.js 1.06 kB 0 B
./frontend/.nuxt/dist/client/components/v-content-page.js 531 B 0 B
./frontend/.nuxt/dist/client/components/v-content-page.modern.js 535 B 0 B
./frontend/.nuxt/dist/client/components/v-content-report-button.js 493 B 0 B
./frontend/.nuxt/dist/client/components/v-content-report-button.modern.js 497 B 0 B
./frontend/.nuxt/dist/client/components/v-content-report-form.js 3.33 kB 0 B
./frontend/.nuxt/dist/client/components/v-content-report-form.modern.js 3.21 kB 0 B
./frontend/.nuxt/dist/client/components/v-content-report-popover.js 3.8 kB +1 B (0%)
./frontend/.nuxt/dist/client/components/v-content-report-popover.modern.js 3.67 kB +1 B (0%)
./frontend/.nuxt/dist/client/components/v-copy-button.js 3.99 kB 0 B
./frontend/.nuxt/dist/client/components/v-copy-button.modern.js 4 kB +1 B (0%)
./frontend/.nuxt/dist/client/components/v-copy-license.js 2.33 kB 0 B
./frontend/.nuxt/dist/client/components/v-copy-license.modern.js 2.31 kB +1 B (0%)
./frontend/.nuxt/dist/client/components/v-dmca-notice.js 792 B 0 B
./frontend/.nuxt/dist/client/components/v-dmca-notice.modern.js 798 B 0 B
./frontend/.nuxt/dist/client/components/v-error-image.js 2.48 kB 0 B
./frontend/.nuxt/dist/client/components/v-error-image.modern.js 2.44 kB 0 B
./frontend/.nuxt/dist/client/components/v-error-section.js 372 B 0 B
./frontend/.nuxt/dist/client/components/v-error-section.modern.js 377 B 0 B
./frontend/.nuxt/dist/client/components/v-external-search-form.js 3.76 kB 0 B
./frontend/.nuxt/dist/client/components/v-external-search-form.modern.js 3.12 kB 0 B
./frontend/.nuxt/dist/client/components/v-external-source-list.js 2.71 kB 0 B
./frontend/.nuxt/dist/client/components/v-external-source-list.modern.js 2.07 kB 0 B
./frontend/.nuxt/dist/client/components/v-full-layout.js 1.57 kB -3 B (0%)
./frontend/.nuxt/dist/client/components/v-full-layout.modern.js 1.58 kB 0 B
./frontend/.nuxt/dist/client/components/v-grid-skeleton.js 1.53 kB 0 B
./frontend/.nuxt/dist/client/components/v-grid-skeleton.modern.js 1.53 kB 0 B
./frontend/.nuxt/dist/client/components/v-hide-button.js 577 B 0 B
./frontend/.nuxt/dist/client/components/v-hide-button.modern.js 576 B 0 B
./frontend/.nuxt/dist/client/components/v-home-gallery.js 4.28 kB 0 B
./frontend/.nuxt/dist/client/components/v-home-gallery.modern.js 4.26 kB 0 B
./frontend/.nuxt/dist/client/components/v-homepage-content.js 1.8 kB 0 B
./frontend/.nuxt/dist/client/components/v-homepage-content.modern.js 1.77 kB 0 B
./frontend/.nuxt/dist/client/components/v-image-cell.js 1.95 kB 0 B
./frontend/.nuxt/dist/client/components/v-image-cell.modern.js 1.94 kB 0 B
./frontend/.nuxt/dist/client/components/v-image-details.js 1.44 kB 0 B
./frontend/.nuxt/dist/client/components/v-image-details.modern.js 1.43 kB -1 B (0%)
./frontend/.nuxt/dist/client/components/v-image-grid.js 4.42 kB +3 B (0%)
./frontend/.nuxt/dist/client/components/v-image-grid.modern.js 4.3 kB +5 B (0%)
./frontend/.nuxt/dist/client/components/v-license-tab-panel.js 641 B 0 B
./frontend/.nuxt/dist/client/components/v-license-tab-panel.modern.js 650 B 0 B
./frontend/.nuxt/dist/client/components/v-load-more.js 1.18 kB 0 B
./frontend/.nuxt/dist/client/components/v-load-more.modern.js 1.07 kB +1 B (0%)
./frontend/.nuxt/dist/client/components/v-media-license.js 933 B 0 B
./frontend/.nuxt/dist/client/components/v-media-license.modern.js 940 B 0 B
./frontend/.nuxt/dist/client/components/v-media-reuse.js 2.99 kB +1 B (0%)
./frontend/.nuxt/dist/client/components/v-media-reuse.modern.js 2.97 kB -1 B (0%)
./frontend/.nuxt/dist/client/components/v-media-tag.js 416 B +1 B (0%)
./frontend/.nuxt/dist/client/components/v-media-tag.modern.js 420 B 0 B
./frontend/.nuxt/dist/client/components/v-modal.js 1 kB -1 B (0%)
./frontend/.nuxt/dist/client/components/v-modal.modern.js 995 B -1 B (0%)
./frontend/.nuxt/dist/client/components/v-no-results.js 2.67 kB 0 B
./frontend/.nuxt/dist/client/components/v-no-results.modern.js 2.03 kB 0 B
./frontend/.nuxt/dist/client/components/v-radio.js 1 kB 0 B
./frontend/.nuxt/dist/client/components/v-radio.modern.js 1.01 kB 0 B
./frontend/.nuxt/dist/client/components/v-related-audio.js 824 B 0 B
./frontend/.nuxt/dist/client/components/v-related-audio.modern.js 742 B 0 B
./frontend/.nuxt/dist/client/components/v-related-audio/pages/search/audio.js 4.38 kB 0 B
./frontend/.nuxt/dist/client/components/v-related-audio/pages/search/audio.modern.js 4.26 kB 0 B
./frontend/.nuxt/dist/client/components/v-related-images.js 803 B 0 B
./frontend/.nuxt/dist/client/components/v-related-images.modern.js 720 B 0 B
./frontend/.nuxt/dist/client/components/v-report-desc-form.js 976 B 0 B
./frontend/.nuxt/dist/client/components/v-report-desc-form.modern.js 981 B 0 B
./frontend/.nuxt/dist/client/components/v-row-layout.js 1.72 kB -1 B (0%)
./frontend/.nuxt/dist/client/components/v-row-layout.modern.js 1.73 kB 0 B
./frontend/.nuxt/dist/client/components/v-safety-wall.js 1.32 kB 0 B
./frontend/.nuxt/dist/client/components/v-safety-wall.modern.js 1.32 kB 0 B
./frontend/.nuxt/dist/client/components/v-scroll-button.js 891 B 0 B
./frontend/.nuxt/dist/client/components/v-scroll-button.modern.js 891 B 0 B
./frontend/.nuxt/dist/client/components/v-search-results-title.js 617 B 0 B
./frontend/.nuxt/dist/client/components/v-search-results-title.modern.js 622 B 0 B
./frontend/.nuxt/dist/client/components/v-server-timeout.js 301 B 0 B
./frontend/.nuxt/dist/client/components/v-server-timeout.modern.js 307 B 0 B
./frontend/.nuxt/dist/client/components/v-single-result-controls.js 1.17 kB 0 B
./frontend/.nuxt/dist/client/components/v-single-result-controls.modern.js 1.17 kB 0 B
./frontend/.nuxt/dist/client/components/v-sketch-fab-viewer.js 1.01 kB +1 B (0%)
./frontend/.nuxt/dist/client/components/v-sketch-fab-viewer.modern.js 915 B +1 B (0%)
./frontend/.nuxt/dist/client/components/v-snackbar.js 1.07 kB 0 B
./frontend/.nuxt/dist/client/components/v-snackbar.modern.js 1.07 kB 0 B
./frontend/.nuxt/dist/client/components/v-warning-suppressor.js 307 B 0 B
./frontend/.nuxt/dist/client/components/v-warning-suppressor.modern.js 311 B 0 B
./frontend/.nuxt/dist/client/pages/about.js 1.42 kB -1 B (0%)
./frontend/.nuxt/dist/client/pages/about.modern.js 1.42 kB 0 B
./frontend/.nuxt/dist/client/pages/audio/_id/index.js 10.6 kB +2 B (0%)
./frontend/.nuxt/dist/client/pages/audio/_id/index.modern.js 10.3 kB +3 B (0%)
./frontend/.nuxt/dist/client/pages/feedback.js 1.36 kB 0 B
./frontend/.nuxt/dist/client/pages/feedback.modern.js 1.36 kB 0 B
./frontend/.nuxt/dist/client/pages/image/_id/report.js 4.95 kB +1 B (0%)
./frontend/.nuxt/dist/client/pages/image/_id/report.modern.js 4.72 kB +1 B (0%)
./frontend/.nuxt/dist/client/pages/index.js 6.34 kB +3 B (0%)
./frontend/.nuxt/dist/client/pages/index.modern.js 6.3 kB -1 B (0%)
./frontend/.nuxt/dist/client/pages/preferences.js 1.32 kB 0 B
./frontend/.nuxt/dist/client/pages/preferences.modern.js 1.31 kB 0 B
./frontend/.nuxt/dist/client/pages/privacy.js 1.26 kB 0 B
./frontend/.nuxt/dist/client/pages/privacy.modern.js 1.26 kB -1 B (0%)
./frontend/.nuxt/dist/client/pages/search-help.js 1.62 kB 0 B
./frontend/.nuxt/dist/client/pages/search-help.modern.js 1.61 kB 0 B
./frontend/.nuxt/dist/client/pages/search.js 8.41 kB 0 B
./frontend/.nuxt/dist/client/pages/search.modern.js 7.58 kB 0 B
./frontend/.nuxt/dist/client/pages/search/audio.js 502 B -1 B (0%)
./frontend/.nuxt/dist/client/pages/search/audio.modern.js 505 B 0 B
./frontend/.nuxt/dist/client/pages/search/image.js 460 B 0 B
./frontend/.nuxt/dist/client/pages/search/image.modern.js 462 B 0 B
./frontend/.nuxt/dist/client/pages/search/index.js 316 B 0 B
./frontend/.nuxt/dist/client/pages/search/index.modern.js 320 B +4 B (+1%)
./frontend/.nuxt/dist/client/pages/search/model-3d.js 241 B -1 B (0%)
./frontend/.nuxt/dist/client/pages/search/model-3d.modern.js 245 B -1 B (0%)
./frontend/.nuxt/dist/client/pages/search/video.js 238 B -1 B (0%)
./frontend/.nuxt/dist/client/pages/search/video.modern.js 243 B 0 B
./frontend/.nuxt/dist/client/pages/sources.js 1.53 kB -1 B (0%)
./frontend/.nuxt/dist/client/pages/sources.modern.js 1.54 kB -1 B (0%)
./frontend/.nuxt/dist/client/runtime.js 2.76 kB +7 B (0%)
./frontend/.nuxt/dist/client/runtime.modern.js 2.77 kB +7 B (0%)
./frontend/.nuxt/dist/client/vendors/app.js 68.5 kB 0 B
./frontend/.nuxt/dist/client/vendors/app.modern.js 68.1 kB 0 B

compressed-size-action

@github-actions
Copy link

Full-stack documentation: https://docs.openverse.org/_preview/2734

Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again.

You can check the GitHub pages deployment action list to see the current status of the deployments.

@obulat obulat force-pushed the add/VCollectionHeader_component branch from f19d4e1 to 0eef2b7 Compare July 27, 2023 14:50
@obulat obulat marked this pull request as ready for review July 27, 2023 14:50
@obulat obulat requested a review from a team as a code owner July 27, 2023 14:50
@obulat obulat requested review from AetherUnbound, sarayourfriend and fcoveram and removed request for sarayourfriend July 27, 2023 14:51
Copy link
Contributor

@fcoveram fcoveram left a comment

Choose a reason for hiding this comment

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

I wonder if we can detect when h1 changes to two lines and align the content (icon, text, and button) in the top. In small and big breakpoints the outcome looks bad. Besides, the label's button shrinks.

xs lg
Collection header in XS breakpoint Collection header in LG breakpoint

Comment on lines 2 to 10
<div class="flex flex-col gap-y-6 lg:gap-y-8">
<div class="flex flex-col gap-4 lg:flex-row lg:justify-between">
<div class="flex items-center gap-x-2">
<VIcon :name="iconName" :size="isDesktop ? 10 : 6" />
<h1 class="text-3xl font-semibold leading-6 lg:text-6xl lg:leading-10">
{{ title }}
</h1>
Copy link
Contributor

Choose a reason for hiding this comment

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

In md I envision a white gap in the top-right area for most cases. To avoid that, I think we should try changing to flex-row from md instead of lg .

@zackkrida zackkrida marked this pull request as draft August 2, 2023 14:23
@zackkrida
Copy link
Member

Drafting while requested changes are worked on.

@obulat obulat force-pushed the add/VCollectionHeader_component branch 2 times, most recently from ab5cd5c to bf83e35 Compare August 18, 2023 16:43
@obulat
Copy link
Contributor Author

obulat commented Aug 18, 2023

I updated the styles to match the mockups better, and to go from a row to a column starting from the md breakpoint. Ready for review :)

@obulat obulat marked this pull request as ready for review August 18, 2023 16:55
@obulat obulat requested a review from fcoveram August 18, 2023 16:55
Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

This looks excellent so far, but there are a few things that need changing and clarification before I can approve. I've requested blocking changes to the story (change the id control's name) and the event configuration. I've suggested non-blocking but strongly recommended changes to the props for the component. Lastly, I've added a rather long question about how best to manage translation of the subtitle for each collection type. This didn't occur to me during design reviews but is rather significant if we're going to do it correctly. I suggested a workaround that might be a good stop-gap if we want to avoid blocking on this complexity. The workaround would need to be implemented alongside the prop changes.

Comment on lines 75 to 83
/**
* The label showing the result count, to display below the title.
*/
resultsLabel: {
type: String,
required: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Passing the result label manually like this results in the storybook example not quite matching the designs, but only be consequence of the story configuration. The creator design has different text than the other collections:

image

If we changed the component to accept a configuration object on the collection prop where collection could be a union of the following interfaces:

interface BaseCollection {
  type: unknown
  mediaType: MediaType
  resultCount: number
  title: string
}

interface TagCollection extends BaseCollection {
  type: 'tag'
}

interface SourceCollection extends BaseCollection {
  type: 'source'
  url: string
}

interface CreatorCollection extends BaseCollection {
  type: 'creator'
  source: string
  url: string
}

Then the component should select the correct template string and interpolate title, resultCount, mediaType and, if a creator, source.

There are probably some linguistic difficulties here though that might warrant passing individual source names to the translators... Some sources really need a definite article and others do not. Maybe leaving the definite article out is okay in English for some. "10000 results from Museum of Modern Art" reads clumsy to me. "10000 results from the Museum of Modern Art" would be better. But "10000 results from the NASA" is incorrect. In Portuguese the definite article is always included in the word "from" ("10000 resultados do Museum of Modern Art"). However, even then, the grammatical gender should be considered. If we had a source "Biblioteca Nacional do Brasil", the grammatical gender is feminine and it should be "10000 resultados da Biblioteca Nacional do Brasil".

I wonder if everywhere we are going to interpolate a source name into a sentence, whether we need to create a translation string for it, like automatically generating certain translations from the stats endpoints. We wouldn't translate the source names themselves, necessarily (though that may be appropriate in some cases, and transliterating source names could be useful for languages with non-Latin script), but it would still be necessary context for minimally correct translation in some languages. It would be jarring to read "10000 resultados do Public Library of New York" for an adult with English literacy, but all the more so (and potentially incomprehensible) for a child, e.g., in an educational context. We can't do anything about creator names, of course, but the list of sources is trivially obtainable and limited (unlike creator names of which there are probably hundreds of thousands and most cannot or shouldn't be translated or transliterated anyway).

If we're going down the road of creating sentences from source names, however, it does seem like something that we could consider in an entirely separate issue. I don't know exactly how adding those strings to en.json5 would work, if we could do so reliably, etc. We could go with a naive approach now that avoids needing to do any translations... maybe "10000 images - Biblioteca Nacional do Brasil", "10000 tagged images", and "10000 images - sarayourfriend, Flickr" (not concrete suggestions).

In either case, I think passing the resultsLabel in this way sort of invites accidental misuse or unintentionally duplicating similar translation strings.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great catch and suggestions.

Translating source names sound interesting, we can certainly can create an improvement issue to provide better context. So far, I like the following suggestion for the sentence.

10000 images - sarayourfriend, Flickr

Although I would replace the dash with a period to end up with something like this: 10000 images. sarayourfriend, Flickr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sarayourfriend, I started to implement changes to the label here, and then realized that it needs more props for some of the collection kinds (media type to show whether it's "... images" or "...audio files", results count, etc.). It's better to create the label in the parent component (the collection page that already has all the necessary information)

Copy link
Contributor

Choose a reason for hiding this comment

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

That's why I suggested the expanded collection type, to encode the required information for each collection type. I generally have a preference for logic being as "low" in the component tree with higher components only responsible for overall layout, but where you think it would be best to do. Anywhere we put it will include the same complexity.

Comment on lines 228 to 229
/** The permalink to the source's homepage */
url: string
Copy link
Contributor

Choose a reason for hiding this comment

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

How does url get used for filtering? For creator links, it will be a unique URL. Does it need to be the creator link? Could it just be the source slug? That would be easier to filter on most of the time.

Comment on lines 226 to 227
/** The unique ID of the media */
id: string
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we rename this to collectionType? The comment doesn't appear to be related to this event either.

Suggested change
/** The unique ID of the media */
id: string
/** The type of collection, either "source" or "creator" (tags do not have external links) */
collectionType: "source" | "creator"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The id property here should be removed, and collectionType is not necessary.

This event is fired when the user clicks on the external source link on the source collection page (the black button in the snapshots here).
When the user clicks on the creator's external link, a different event (VISIT_CREATOR_LINK) is fired.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could probably replace the url with the source slug - to make sure that if we ever change the URL we link to, the event is still the same.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea!

Comment on lines 46 to 49
id: {
options: ["tag", "source", "creator", "source-with-long-name"],
control: { type: "select" },
},
Copy link
Contributor

Choose a reason for hiding this comment

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

id is a confusing name for this. I didn't understand what it did in the story controls until reading the code. example-collection would be clearer. Note: changing the name here requires updating the Template story implementation as well.

I wonder if we need two different stories, though? The all collections story feels entirely appropriate for the default story. It isn't a huge component that is a drag to use if all the examples are rendered at a single time.

Comment on lines 8 to 13
for (const collection of [
"tag",
"creator",
"source",
"source-with-long-name",
]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we use the all collections story for this test instead then we don't need individual tests here. Is that worse for testing, though? I guess this way if only the tag changes then we have a tag-specific test that catches that change, rather than needing to dig through the diff to identify where the change is coming from.

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 refactored the story so that it's a single story for all 4 cases.

@sarayourfriend sarayourfriend marked this pull request as draft August 21, 2023 04:53
Copy link
Contributor

@fcoveram fcoveram left a comment

Choose a reason for hiding this comment

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

It looks great. Just two comments:

  • For the three variants, the horizontal layout in md is correct, but h1 should follow the same style as in xs / sm
  • In Source, the results sentence should say 10000 images provided by this source instead of 10000 images from <source name>. This was thought to avoid i18n conflicts.

@obulat
Copy link
Contributor Author

obulat commented Aug 22, 2023

It looks great. Just two comments:

  • For the three variants, the horizontal layout in md is correct, but h1 should follow the same style as in xs / sm
  • In Source, the results sentence should say 10000 images provided by this source instead of 10000 images from <source name>. This was thought to avoid i18n conflicts.

I updated the h1 style to change after the lg breakpoint. As for the result sentences, those should be passed as props by the parent component, so we should update them in the PR that creates the page for the additional search views.

@obulat obulat force-pushed the add/VCollectionHeader_component branch from b88b4ef to 7de0899 Compare August 22, 2023 07:12
@obulat obulat force-pushed the add/VCollectionHeader_component branch 2 times, most recently from 5c1991e to 9273642 Compare August 22, 2023 16:29
Copy link
Contributor

@fcoveram fcoveram left a comment

Choose a reason for hiding this comment

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

My suggestion about applying the horizontal layout to md looks great, but I didn't consider that a smaller font size would break the alignment due to a 40px icon. The outcome looks broken.

Creator results variant of Collection header component

I tried different ideas, but the best solution is going back to the previous text style ("Heading 2") but keeping the horizontal composition. Sorry for not anticipating this.

Button alignment

As a minor detail, the horizontal layout pushes the black button to the edge and creates a disalignment when it's close to the big text. We can solve this by adding a margin-top: 4px to the button. Here is my test in Chrome inspector.

Source variant of Collection header component. Margin values in Chrome inspector are highlighted

Since this is only for the horizontal layout (md / lg / xl / 2xl), the button margin should disappear in xs / sm.

Results sentence

And finally, would this suggestion be address in this PR?

@obulat
Copy link
Contributor Author

obulat commented Aug 23, 2023

@fcoveram, I reverted the breakpoint change for the h1 style (it's md: now instead of lg:) and added the top margin for breakpoints above md. I also updated the snapshot tests so that you can see all of the breakpoints, not only 2.
As for the texts, I updated the creator results label according to the suggestion, but they will also be updated in the PR that fixes #2774

@obulat obulat requested a review from fcoveram August 23, 2023 09:27
Copy link
Contributor

@fcoveram fcoveram left a comment

Choose a reason for hiding this comment

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

It looks great 🚀 ✨

@sarayourfriend
Copy link
Contributor

@obulat I was waiting for a final verdict on the sub-heading templating here: #2734 (comment)

Can you confirm the plan? I'll review on Monday if this PR is ready to go, but then I think we'll need a new issue to record the changes/complexities of that sub-heading.

@obulat
Copy link
Contributor Author

obulat commented Aug 25, 2023

Can you confirm the plan? I'll review on Monday if this PR is ready to go, but then I think we'll need a new issue to record the changes/complexities of that sub-heading.

Thank you, @sarayourfriend . The plan is to move the discussion of the changes/complexities of the sub-heading to #2774 that will create the subheading, translate it and pass as a prop to VCollectionHeader.

Copy link
Contributor

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

LGTM!

Just two things:

  • Might be worth update the sub-heading in the story to be a generic sub-heading text like "example sub-heading" rather than approximating the eventual designs, primarily to prevent confusion about why the story does not match the eventual designs or why the implementation on the final page doesn't match the story either.
  • Something strikes me as unbalanced about the mobile button @fcoveram. Some screenshots for reference below. I don't know if this is because the story has all the different types all in a row (which will never happen in real life) and each of their buttons are slightly different widths (due to different text inside), but I think I do also perceive this unbalanced issue on the Figma designs as well. Particularly with a longer title and full-width image and audio results, the button seems out of place, somehow on the xs size. On the sm size it looks weird for it to be full-width, though.

With the story's grey background removed
image

Full width on xs size
image

Full width on sm size
image

Not sure what the solution is, or if it needs a change at all, even. But thought I would mention it just in case.

In any case, it doesn't need any changes in this PR, it can be addressed in a follow up issue if necessary.

Good work @obulat

@obulat obulat force-pushed the add/VCollectionHeader_component branch from 189c051 to 59a26d5 Compare August 28, 2023 05:42
@obulat obulat merged commit 1c1d9f5 into main Aug 28, 2023
46 checks passed
@obulat obulat deleted the add/VCollectionHeader_component branch August 28, 2023 07:39
@fcoveram
Copy link
Contributor

Thanks for the suggestion @sarayourfriend; that section kept me iterating different ideas a lot. Unfortunately, one spacing solution doesn't work for horizontal and vertical layouts.

But in the future, we can try showing the view name next to the icon on xs to break down that imbalance. Here is a mockup.

Header area of source content view

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕹 aspect: interface Concerns end-users' experience with the software 🌟 goal: addition Addition of new feature 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: documentation Related to Sphinx documentation 🧱 stack: frontend Related to the Nuxt frontend
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Component: VCollectionHeader
5 participants