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

feat(DensityContainer): add package #2618

Merged
merged 17 commits into from
Dec 7, 2023

Conversation

cf-remylenoir
Copy link
Collaborator

@cf-remylenoir cf-remylenoir commented Nov 27, 2023

Purpose of PR

Introduces the DensityContainer component to empower our consumers to control the density of their UI/UX.

Collaboration with Product Design is achieved to define the tokens/values of the components in high-density.

These components have been updated in #2620 for high-density support:

Usage

  • A low density results in the default experience.
  • A high density results in a denser UI, allowing more content and actions to fit on a single screen.

Support

The density support to the components is possible via the useDensity hook.

PR Checklist

  • I have read the relevant readme.md file(s)
  • All commits follow our Git commit message convention
  • Tests are added/updated/not required
  • Tests are passing
  • Storybook stories are added/updated/not required
  • Usage notes are added/updated/not required
  • Has been tested based on Contentful's browser support
  • Doesn't contain any sensitive information
  • Publish the package to make it available in the SandpackRendered
  • Resolve undefined export in SandpackRenderer

Copy link

changeset-bot bot commented Nov 27, 2023

⚠️ No Changeset found

Latest commit: 0a91bfd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cf-remylenoir cf-remylenoir self-assigned this Nov 27, 2023
Copy link

vercel bot commented Nov 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
forma-36 ✅ Ready (Inspect) Visit Preview Dec 6, 2023 3:59pm

@cf-remylenoir cf-remylenoir force-pushed the F36-1061-eng-build-high-density-container branch from 96e3499 to 40956d6 Compare November 27, 2023 18:46
Copy link

github-actions bot commented Nov 27, 2023

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
CommonJS 129.74 KB (0%) 2.6 s (0%) 80 ms (+48.65% 🔺) 2.7 s
Module 126.23 KB (0%) 2.6 s (0%) 57 ms (+8.62% 🔺) 2.6 s

@cf-remylenoir cf-remylenoir force-pushed the F36-1061-eng-build-high-density-container branch from 356e60d to cc8f730 Compare November 28, 2023 13:50
Copy link
Collaborator

@Lelith Lelith left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Co-authored-by: Thomas Kellermeier <Chaoste@users.noreply.github.com>
@cf-remylenoir
Copy link
Collaborator Author

@damann happy to get your eyes on this when time allows it 👍

Copy link
Contributor

@DanweDE DanweDE left a comment

Choose a reason for hiding this comment

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

One thought, LTM otherwise.

import { useDensity } from '@contentful/f36-utils';

export default function YourComponent() {
const density = useDensity();
Copy link
Contributor

@DanweDE DanweDE Dec 6, 2023

Choose a reason for hiding this comment

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

Wondering if it'd already make sense to let components declare what densities they support.

E.g.

Suggested change
const density = useDensity();
const density = useDensity(['high', 'low']);

so if we introduce a new density 'higher' at some point, the hook would fall back to the next best supported density 'high', instead of rendering low density below.

Depends a bit on the future outlook and how much we anticipate components outside of F36 to rely on the hook.

Copy link
Collaborator Author

@cf-remylenoir cf-remylenoir Dec 7, 2023

Choose a reason for hiding this comment

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

It is good to think of this upfront, thank you for bringing it up.

In the immediate future, only high density is to be offered, this won't change unless we decide to change our scaling system and maybe adopt the concept of view preferences for our UI (default, comfortable, compact).

To be discussed further with @damann.

@cf-remylenoir cf-remylenoir merged commit 9d277ba into main Dec 7, 2023
12 checks passed
@cf-remylenoir cf-remylenoir deleted the F36-1061-eng-build-high-density-container branch December 7, 2023 10:09
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.

5 participants