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

OSS::InformationSection component from 2FA branch #459

Merged
merged 9 commits into from
Dec 18, 2024

Conversation

OwenCoogan
Copy link
Contributor

What does this PR do?

It adds a new component used in the 2FA project

Capture d’écran 2024-12-16 à 15 44 32
Capture d’écran 2024-12-16 à 15 44 13
Capture d’écran 2024-12-16 à 15 36 56
Capture d’écran 2024-12-16 à 12 05 44

Related to: #

What are the observable changes?

Good PR checklist

  • Title makes sense
  • Is against the correct branch
  • Only addresses one issue
  • Properly assigned
  • Added/updated tests
  • Added/updated documentation
  • Migrated touched components to Glimmer Components
  • Properly labeled

@@ -0,0 +1,41 @@
<div
data-control-name="information-section"
class="oss--information-section border-radius-md border-color-gray-200 box-shadow-md"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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 -

Copy link
Contributor Author

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"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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

Copy link
Contributor Author

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"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
data-control-name="information-section--title"
data-control-name="information-section-title"

Copy link
Contributor Author

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>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<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>

Copy link
Contributor Author

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" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<hr class="oss--information-section__separator" />
<hr class="oss-information-section__separator" />

Copy link
Contributor Author

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: {
Copy link
Contributor

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 }

Copy link
Contributor Author

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';
Copy link
Contributor

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?

Copy link
Contributor Author

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"
Copy link
Member

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?

Copy link
Contributor Author

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;
Copy link
Member

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

Copy link
Contributor Author

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 {
Copy link
Member

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 ? :)

Copy link
Contributor Author

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

Comment on lines 11 to 17
{{#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}}
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

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 🤔

Copy link
Contributor Author

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}}"
Copy link
Member

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?

Copy link
Contributor Author

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

@OwenCoogan OwenCoogan merged commit 9e5c64e into master Dec 18, 2024
3 checks passed
@OwenCoogan OwenCoogan deleted the feature-branch/2fa branch December 18, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants