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

Skeleton #549

Open
18 tasks
Ibabalola opened this issue Oct 23, 2023 · 0 comments
Open
18 tasks

Skeleton #549

Ibabalola opened this issue Oct 23, 2023 · 0 comments
Assignees
Labels
new component new component
Milestone

Comments

@Ibabalola
Copy link
Contributor

Ibabalola commented Oct 23, 2023

As a developer
I want to be able to use a Skeleton component
so that I can display a placeholder preview for content that is loading to reduce user frustration

The component should contain:

  • Embedded className called dcx-skeleton for all the variant
  • Embedded className called dcx-skeleton-text if variant is text (dcx-skeleton dcx-skeleton-text)
  • Embedded className called dcx-skeleton-circular if variant is circular (dcx-skeleton dcx-skeleton-circular)
  • Embedded className calleddcx-skeleton-rectangular if variant is rectangular (dcx-skeleton dcx-skeleton-rectangular)
  • Embedded className called dcx-skeleton-rounded if variant is rounded (dcx-skeleton dcx-skeleton-rounded)
  • Add appropriate aria states for Accessibility aria-live and aria-busy

Code Guidance:

import { classNames } from '../common';
....
//for text variant
className={classNames(['dcx-skeleton', 'dcx-skeleton-text', className])}

Available Props:

  • Relevant 'optional' classes for shared / reusable styling
  • Add 'mandatory' variant prop it will be: text, circular , rectangular or rounded
  • Add 'optional' fontSize prop (default should be 1rem)
  • Add 'optional' width prop (default should be 40px)
  • Add 'optional' height prop (default should be 40px)
  • Add 'optional' animator prop, which we will either pulsate or wave (with css) or be disable entirely animation="wave|pulsate" to disable omit the animator prop
  • Add the ability to specify other props (...props)

Code Guidance:

//Relevant classes for shared / reusable styling
className?: string;
//It will define the look and feel of the skeleton
variant: 'text' | 'circular' | 'rectangular' | 'rounded';
// this property is used only for the variant text and will define the size of it. If not specified will have 1rem 
fontSize?: string;	// by default 1rem
// this property is used for the other variants ('circular' | 'rectangular' | 'rounded') and will define the width of it. If not specified will have 40px
width?: string; // by default 40px
// this property is used for the other variants ('circular' | 'rectangular' | 'rounded') and will define the width of it. If not specified will have 40px
height?: string; // by default 40px
// this property is used to animate the skeleton component thought some css that we need to provide. We want to provide by default the wave and the pulsate animate. When this property is not passed that it will not animate
animation?: 'wave'| 'pulsate"; // if not provided will disable the animation
//additional properties to support something else that we didn't plan
props?: React.HTMLAttributes<HTMLElement>;

Example:

{/* For variant="text", adjust the height via font-size */}
<Skeleton variant="text" fontSize="1rem" className="myClassName" props={{ ...props}} animator='wave' />
{/* For other variants, adjust the size with `width` and `height` */}
<Skeleton variant="circular" width='40px' height='40px' props={{...props}} className="myClassName" />
<Skeleton variant="rectangular" width='210px' height='60px' props={{...props}} className="myClassName" />
<Skeleton variant="rounded" width='210px' height='60px' props={{...props}} className="myClassName" />

The final user will use in this way:

{
  item ? (
    <img
      style={{
        width: 210,
        height: 118,
      }}
      alt={item.title}
      src={item.src}
    />
  ) : (
    <Skeleton variant="rectangular" className="myClassName" width='210px' height='118px' props={{...props}} />
  );
}

Behind the scenes the Skeleton component could be like so:

<span
className="dcx-skeleton dcx-skeleton-circular dcx-skeleton-pulse|wave myClassName text | rounded | rectangular | circular "
style="width:40px;height:40px"
aria-live="polite"
aria-busy="true|false"
>
</span>

Tasks:

  • Add unit tests
  • Add Application code with commented props
  • Add Demo use of component
  • Add to storybook documentation file with examples (.mdx) in a section called layout
  • Add to live demo

Please follow the below to create your branch

git checkout release/1.1.0
git pull
git checkout -b 'feature/skeleton'
@Ibabalola Ibabalola added the new component new component label Oct 23, 2023
@Ibabalola Ibabalola added this to the 1.0.0 milestone Oct 23, 2023
@daniele-zurico daniele-zurico modified the milestones: 1.0.0, 1.1.0 Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new component new component
Projects
None yet
Development

No branches or pull requests

3 participants