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 secondary variant to CardTitle and CardHeader #1001

Merged
merged 1 commit into from
Apr 27, 2023
Merged

Conversation

lyzadanger
Copy link
Contributor

This PR expresses a design pattern we are using in the lms application by updating variants for CardTitle and CardHeader to add a new secondary variant (default is primary, the way it "looked before.").

This captures the pattern we've started using in panels in the lms app. It will make markup more straightforward for LMS components, and make prototyping within panels of that style faster and more consistent.

Partial screen grab of updated Card pattern library page, in the CardHeader section:

image

@@ -4,7 +4,15 @@ import type { JSX } from 'preact';
import type { PresentationalProps } from '../../types';
import { downcastRef } from '../../util/typing';

type ComponentProps = {
/** Wrap the title with this HTML heading tag */
tagName?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
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 realized that we lost something in the most recent round of Card and Panel implementations: we aren't using heading elements. For HTML semantics and accessibility it is best if we do. This prop allows a consumer to use a different heading level than default (h1) if so desired.

@codecov
Copy link

codecov bot commented Apr 26, 2023

Codecov Report

Merging #1001 (5f470fb) into main (7844a21) will decrease coverage by 0.15%.
The diff coverage is 87.50%.

@@             Coverage Diff             @@
##              main    #1001      +/-   ##
===========================================
- Coverage   100.00%   99.85%   -0.15%     
===========================================
  Files           53       53              
  Lines          700      707       +7     
  Branches       238      244       +6     
===========================================
+ Hits           700      706       +6     
- Misses           0        1       +1     
Impacted Files Coverage Δ
src/components/layout/CardHeader.tsx 90.90% <80.00%> (-9.10%) ⬇️
src/components/layout/CardTitle.tsx 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@lyzadanger
Copy link
Contributor Author

I'll fix the test miss tomorrow.

Copy link
Contributor

@acelaya acelaya left a comment

Choose a reason for hiding this comment

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

LGTM

className={classnames(
{
'text-lg text-brand font-semibold': variant === 'primary',
'text-xl text-slate-7 font-normal': variant === 'secondary',
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 text supposed to be bigger on secondary variant? Is that intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it actually is!

This expresses a design pattern we are using in the `lms` application.
@lyzadanger lyzadanger merged commit adaaa78 into main Apr 27, 2023
@lyzadanger lyzadanger deleted the card-variant branch April 27, 2023 18: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.

2 participants