-
Notifications
You must be signed in to change notification settings - Fork 17
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(hero)!: convert to CSS modules #299
Conversation
π¦ Changeset detectedLatest commit: 68c8004 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is being automatically deployed with Vercel (learn more). π Inspect: https://vercel.com/hashicorp/react-components/5u56SUEYWUNvsH78sfbheVN3jB7t |
0c90d04
to
841b605
Compare
@@ -226,6 +226,10 @@ module.exports = { | |||
description: 'Whether or not to center the hero content', | |||
testValue: false, | |||
}, | |||
className: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added support for className
, in case it's needed to deal with potential g-hero overrides.
'@hashicorp/react-text-input': minor | ||
--- | ||
|
||
- β¨ Adds support for a className prop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding className
support to text-input
was necessary to avoid a :global
override selector previously used in hero
.
|
||
const defaultProps = getTestValues(props) | ||
|
||
it('should add a provided className to the root element', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the className
prop in this PR, so felt right to add a corresponding test.
const error = form.touched[field.name] && form.errors[field.name] | ||
// Label htmlFor relies on an id on the input field, which must be | ||
// unique to prevent collisions between fields or forms on the same page | ||
const inputId = 'u' + uuidv1() | ||
return ( | ||
<div | ||
className="g-text-input" | ||
className={classNames('g-text-input', className)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessary to support hero-related styling.
@@ -15,7 +15,6 @@ | |||
@import '../packages/consent-manager/style.css'; | |||
@import '../packages/toggle/style.css'; | |||
@import '../packages/text-input/style.css'; | |||
@import '../packages/hero/style.css'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
πͺ π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π
className={classnames(s.videoWrapper, { | ||
[s.isActive]: this.state.active === i, | ||
[s.isDeactivating]: this.state.deactivating === i, | ||
})} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clean!
packages/hero/carousel.module.css
Outdated
position: relative; | ||
transform: translateX(-60px); | ||
line-height: 0; | ||
box-shadow: 0 14.3254px 14.3254px rgba(37, 41, 55, 0.16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow those are some crazy fractions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i'ma clean these up. As mentioned in other CSS comments, just flat out copy-pasted old styles for consistency, but this is pretty distracting π
|
||
&.isActive { | ||
opacity: 1; | ||
padding-top: calc((100% * 0.63569) + 28px); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious where this value came from π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be honest, I have no idea - have just ported over old styles. Also curious, so I'll try to figure it out and add some comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
β
Okay so it's aspect ratio related - ensures there's no layout shift as the video loads. I added a clarifying comment here, and added a note on expected aspect ratio to props.js
π
|
||
.bar { | ||
align-items: center; | ||
background: #0e1016; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have color vars for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of - here's as-is, with the current hard-coded HEX values:
Closest var-friendly alternative with --black
and --gray-1
:
Definitely slightly different, but could definitely see the case for switching. I do worry a little about tying this tweak in with the modules change - even though it feels super minor, I think there are cases where it the difference would be noticeable, eg if the BG is full --black
. So going to leave as-is for now, but definitely on board with rooting out HEX values in the future π
width: 100%; | ||
|
||
& span { | ||
background: #252937; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have color vars for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to follow-up here - details in #299 (comment)
packages/hero/index.js
Outdated
/* Note: has-videos is only used in Percy on www-next. Should likely be removed */ | ||
{ 'has-videos': hasVideos }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this now π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
β
ποΈ Asana Task
π Preview Link
This PR updates
@hashicorp/react-hero
to use CSS modules.PR Checklist π
Items in this checklist may not may not apply to your PR, but please consider each item carefully.