-
Notifications
You must be signed in to change notification settings - Fork 3
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
[OffcanvasHeader.js] Update API for HTML standard, simplify attribute naming, & migrate to named slots #216
base: dev
Are you sure you want to change the base?
Conversation
COMPLETED TASK FOR MAY 16, 2024:Task 202: Simplify attribute naming conventions
There are no attributes in the OffcanvasHeader component that behave like global or standard element attributes, so no changes are needed here.
In the OffcanvasHeader component, we have the following attributes with the data- prefix: data-parent-id After the update, these attributes should be: parent-id These values were also updated:
The OffcanvasHeader component does not have attributes that are used in multiple components, so this step does not apply.
There are no attributes in the OffcanvasHeader component that have similar functionality to attributes in other components, so no changes are needed here.
The attributes in the OffcanvasHeader component (data-parent-id, data-button-dark, data-extra-classes, data-expand) are specific to its functionality and do not need to be updated for consistency with other components. |
COMPLETED TASK FOR MAY 17, 2024:Task 201: Update component API to adhere to HTML standard microsyntaxes
NOTE:Added data- back to the lines below until I work on the cod-button component: |
May 20, 2024 Update:Opened up branch: issue.201-2-5.2 for the Button.js component in order to update attributes there so these lines can be properly updated in OffcanvasHeader.js:
|
May 21, 2024 Update:Updated the following attributes: data-parent-id After the update, these attributes should be: parent-id (updated)
|
QUESTIONS FOR OFFCANVASHEADER.JS: @maxatdetroit
|
NEXT STEP AS OF MAY 21, 2024:Task 205: Migrate to named slots with basic markup where possible
|
NOTE TO SELF: yarn lint & yarn prettier -w "FILENAME" ==> how to fix prettier issue |
Yes, it needs to be updated. This is where it gets set: COD-Design-System/src/components/organisms/Offcanvas/Offcanvas.js Lines 30 to 32 in 5813842
Yes, they do. See the story file or storybook page for offcanvas to see how they get used together.
Thanks for the example. Yes, both 'setters' and 'getters' should be updated if we update the attribute name. |
When updating to named slots, should we also change how the styles are being added @maxatdetroit? Something this: |
@sreidthomas no, you can continue to add the styles like they were previously (using javascript in the constructor). We're going to rework how we add stylesheets as part of #171. |
WHAT WAS DONE:
Update component API to adhere to HTML standard microsyntaxes, simplify attribute naming conventions, and migrate to named slots with basic markup where possible
ISSUE:
We have some components that handle attribute values in non-standard ways, use non-standard attribute naming conventions, and unnecessarily nest custom components instead of using named slots.
OVERALL TASK / JOB DUTIES:
ADDITIONAL NOTES:
Nested, custom components should only be used when:
Each time we update component attributes or migrate to named slots, we'll need to:
• Update the attribute in the component JS implementation.
• Update the attribute definition and Storybook param names in the story file.
Components are distributed in this spreadsheet:
https://is.gd/ETzUCF
Breakdown of individual tasks for each issue:
Task 201: Update component API to adhere to HTML standard microsyntaxes
• For boolean attributes, ensure values are true or false instead of non-standard values.
• For color attributes, ensure values are valid color representations (e.g., hex, RGB, or color names).
• For attributes with space-separated tokens, ensure tokens are separated by spaces.
• For attributes with comma-separated tokens, ensure tokens are separated by commas.
Task 202: Simplify attribute naming conventions
• Removing data-* prefixes for attributes that behave like global or standard element attributes.
• Using existing global or standard element attribute names where possible.
• Removing unnecessary prefixes for custom attributes.
• Ensuring consistency in attribute names across components.
• Update the attribute in the component JS implementation.
• Update the attribute definition and Storybook param names in the story file.
Task 205: Migrate to named slots with basic markup where possible
• Removing nested custom components and using named slots instead.
• Refactoring components to accept content via named slots instead of attributes.
• Updating component documentation and examples to reflect the use of named slots.