-
Notifications
You must be signed in to change notification settings - Fork 1
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
OSS::InformationSection component from 2FA branch #459
Conversation
OSS::InformationSection component
@@ -0,0 +1,41 @@ | |||
<div | |||
data-control-name="information-section" | |||
class="oss--information-section border-radius-md border-color-gray-200 box-shadow-md" |
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.
class="oss--information-section border-radius-md border-color-gray-200 box-shadow-md" | |
class="oss-information-section border-radius-md border-color-gray-200 box-shadow-md" |
According to BEM --
is to modifier, maybe just use -
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.
Cleaned up
> | ||
<div | ||
class="fx-row fx-malign-space-between fx-xalign-center padding-px-18 {{this.plainClass}}" | ||
data-control-name="information-section--header" |
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.
data-control-name="information-section--header" | |
data-control-name="information-section-header" |
We never use double dash in data-control-name
, maybe just use single dash
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.
Cleaned up
|
||
<div class="fx-col fx-gap-px-3"> | ||
<span | ||
data-control-name="information-section--title" |
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.
data-control-name="information-section--title" | |
data-control-name="information-section-title" |
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.
Cleaned up
</span> | ||
|
||
{{#if @subtitle}} | ||
<span data-control-name="information-section--subtitle" class="font-color-gray-500">{{@subtitle}}</span> |
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.
<span data-control-name="information-section--subtitle" class="font-color-gray-500">{{@subtitle}}</span> | |
<span data-control-name="information-section-subtitle" class="font-color-gray-500">{{@subtitle}}</span> |
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.
Cleaned up
{{yield to="action"}} | ||
</div> | ||
{{#if (has-block "content")}} | ||
<hr class="oss--information-section__separator" /> |
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.
<hr class="oss--information-section__separator" /> | |
<hr class="oss-information-section__separator" /> |
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.
Cleaned up
export default { | ||
title: 'Components/OSS::InformationSection', | ||
argTypes: { | ||
title: { |
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.
For title, according to the TS typing, can you add type: { required: true }
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 additional param
|
||
export default class OSSInformationSection extends Component<InformationSectionArgs> { | ||
get plainClass(): string { | ||
return this.args.plain === false ? 'background-color-gray-50' : 'background-color-white'; |
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.
For undefined
value, you want the plain effect? Like the true
value?
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.
Yep, thats it, plain === true would mean the header & content have a white background, plain === false would only have the header in gray. plain === undefined defaults out to all white
@@ -0,0 +1,41 @@ | |||
<div | |||
data-control-name="information-section" | |||
class="oss--information-section border-radius-md border-color-gray-200 box-shadow-md" |
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.
just oss-information-section
as it's not a bem modifier but the base class. and also, if you're going to have class here, why not move all the others in its rules?
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.
Moved all to css
import type { IconNames } from './iconName.enum'; | ||
|
||
interface InformationSectionArgs { | ||
badgeIcon?: keyof typeof IconNames; |
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.
not sure about the typing here, this was an attempt but we ended up never being able to really use it as it doesn't really cover all font awesome. can't it be just string?
and also there is still no way to really enforce it in templates
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.
moved to a string type
import Component from '@glimmer/component'; | ||
import type { IconNames } from './iconName.enum'; | ||
|
||
interface InformationSectionArgs { |
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.
can you group all mandatory args together, and all optional ones together ? :)
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.
Moved mandatory arg to the top
{{#if @badgeIcon}} | ||
<OSS::Badge @icon={{@badgeIcon}} class="border-color-primary-200" /> | ||
{{else if @imageUrl}} | ||
<OSS::Badge @image={{@imageUrl}} class="border-color-primary-200" /> | ||
{{else}} | ||
{{yield to="badge"}} | ||
{{/if}} |
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 don't understand the forced border update here...
also we yield to badge
meaning someone could decide to use a custom badge skin just to discover this line breaks it
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.
Made workaround to be able to have the blue border on default badges without overriding content block
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.
global comment, i see a lot of data-control-name
attributes that look a lot like classes, i don't remember seeing this much granularity in data-control-names considering it's usually really contextual and i have a mixed feeling about that 🤔
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.
left data control name for parent div only
...attributes | ||
> | ||
<div | ||
class="fx-row fx-malign-space-between fx-xalign-center padding-px-18 {{this.plainClass}}" |
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.
if we are going to have a getter in it, why not just do a computedClasses
getter that have all of them + the conditional ones and Array#join
them?
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.
Didn't see the need to array join but the full string is returned in a headerComputedClasses getter
What does this PR do?
It adds a new component used in the 2FA project
Related to: #
What are the observable changes?
Good PR checklist