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

Update: add generic .notify__btn-icon class (fixes #126) #127

Merged
merged 2 commits into from
Jul 4, 2023

Conversation

kirsty-hames
Copy link
Contributor

@kirsty-hames kirsty-hames commented May 24, 2023

Fixes #126

  • Apply .notify__btn-icon to popup icon buttons to inherit styles from Vanilla notify.less.

  • Remove the duplicate styles from Hotgrid (these just repeat what's now inherited from Vanilla).

This means the default Notify button icon style is set in one place but we still have plugin specific classes to target should you want to style these different - although there's good reason for keeping UI button styling consistent.

Ref: similar PR raised for Hotgraphic adaptlearning/adapt-contrib-hotgraphic#276

as these now inherit from .notify__btn-icon in Vanilla notify.less
@kirsty-hames
Copy link
Contributor Author

PR might need tweaking pending Vanilla decision adaptlearning/adapt-contrib-vanilla#443 (comment)

Copy link
Contributor

@swashbuck swashbuck left a comment

Choose a reason for hiding this comment

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

👍

@kirsty-hames
Copy link
Contributor Author

kirsty-hames commented Jun 15, 2023

I've just updated the Vanilla PR to replace the Notify icon button styles with a mixin. For this PR, I'm inclined to keep the current implementation as the addition of the .notify__btn-icon selector will mean backwards compatibility with Vanilla.

The alternative, to include the .notify-btn-icon mixin and remove the .notify__btn-icon selector will mean no button styles will be inherited from Vanilla in versions previous to the Vanilla PR.

Copy link
Contributor

@swashbuck swashbuck left a comment

Choose a reason for hiding this comment

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

👍

@@ -67,7 +67,7 @@ export default function HotgridPopupToolbar(props) {
}

<button
className="btn-icon hotgrid-popup__close"
className="btn-icon notify__btn-icon hotgrid-popup__close"

Choose a reason for hiding this comment

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

Copy link

@StuartNicholls StuartNicholls Jun 20, 2023

Choose a reason for hiding this comment

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

@kirsty-hames, currently we have notify__btn-icon next & notify__btn-icon back So, for consistency and to assist with this perhaps add close here?

That way we can still use the same class/selector and can target the different button types separately.

Note, I think the class naming is off here and should perhaps be is-next / is-previous & is-close. Another reason to rationalise these button classes further!

Copy link
Contributor Author

@kirsty-hames kirsty-hames Jun 20, 2023

Choose a reason for hiding this comment

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

For the purpose of separating the styles for controls and close buttons we could just do this targeting the existing selectors? See below

&__controls {
  .notify-btn-icon;
}
&__close {
  .notify-btn-icon;
}

I do agree the class naming is off here and I'm in favour of a shared selector e.g. .notify__btn-icon and the tag on button type selectors e.g. is-next etc but this will need addressing across Adapt for consistency so perhaps it's best to address this as part of the Adapt button issue. As in capture all button types, agree terminology so we don't have to keep changing templates and then roll out. Might be easier to keep track of consistency that way too.

Choose a reason for hiding this comment

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

I was thinking that stay on target with notify__btn-icon. so not update next/back and just use:

&__btn-icon next, &__btn-icon back {
  .notify-btn-icon;
}

&__btn-icon close {
  .notify-btn-icon;
}

then when it comes to addressing the buttons in that issue I think perhaps this is a longer term problem that has many complexities - but perhaps we'd have adapt utility classes like 'primary-button' & 'secondary-button' (or whatever so they'd be called) in addition to the BEM naming already there. So the is- notation is sort of a separate issue, was just pointing out the problems!

I maybe getting confused here but aren't there only a small handful of places where this would need to change?

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 maybe getting confused here but aren't there only a small handful of places where this would need to change?

This applies to the following plugins/templates:
Controls: Hotgrid and Hotgraphic
Close: Notify popup, Notify push, Hotgraphic, Hotgrid and Tutor.

The existing PR satisfies the issue raised, to reduce duplicate code.

Based on suggestions above, I think next steps is to confirm the class naming for Adapt buttons and then roll out to plugins rather than tackling in this PR.

@kirsty-hames kirsty-hames merged commit 1a738f2 into master Jul 4, 2023
@kirsty-hames kirsty-hames deleted the issue/126 branch July 4, 2023 16:03
github-actions bot pushed a commit that referenced this pull request Jul 4, 2023
# [4.4.0](v4.3.16...v4.4.0) (2023-07-04)

### Update

* add generic .notify__btn-icon class (fixes #126) (#127) ([1a738f2](1a738f2)), closes [#126](#126) [#127](#127)
@github-actions
Copy link

github-actions bot commented Jul 4, 2023

🎉 This PR is included in version 4.4.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

Reduce duplicate code across plugins using notify popup
3 participants