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

feat(bc-footer): Add Brand.com Footer #1450

Merged

Conversation

Guilherme-Almeida-Zeni
Copy link
Collaborator

@Guilherme-Almeida-Zeni Guilherme-Almeida-Zeni commented Mar 11, 2022

Overview

Provide footer for brand.com.

Changes

  • Needed to add bodiless/navigation as dependency for cx-layout package.
  • Needed to add color class variation for footer text (TextPrimaryFooterCopy: 'text-cx-primary-footer-copy').
  • Needed to add tailwind variants for padding, margin, and borderWidth, to allow first and last selectors, in cx-layout package.
  • Exported FooterClean and cxFooter to be used by page layout.
  • Global footer has been added to cxstarter package and activated on starter site.
  • Working Copyright and Footer Menus have been provided.
  • Added slots with placeholder content + styles for responsive Rewards/Social Links.

Test Instructions

Footer can be found at /typography from cxstarter site:

  • npm run setup
  • cd sites/__cxstarter__
  • npm run start

Related Issues

@cypress
Copy link

cypress bot commented Mar 11, 2022



Test summary

64 0 0 0Flakiness 0


Run details

Project bodiless
Status Passed
Commit 62526a2 ℹ️
Started Mar 28, 2022 4:15 PM
Ended Mar 28, 2022 4:23 PM
Duration 08:19 💡
OS Linux Ubuntu - 20.04
Browser Chrome 98

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@Guilherme-Almeida-Zeni Guilherme-Almeida-Zeni force-pushed the feature/bc-footer branch 2 times, most recently from 9594c1e to b9abb10 Compare March 11, 2022 06:53
@Guilherme-Almeida-Zeni Guilherme-Almeida-Zeni linked an issue Mar 11, 2022 that may be closed by this pull request
<C.Wrapper>
<C.Container>
<C.SectionTop>
<C.Rewards />
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have wrappers for these? RewardsWrapper, MenuWrapper, etc? cc @hvanyo

Copy link
Collaborator

Choose a reason for hiding this comment

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

@wodenx I think general rule is Wrap all slots for flexibility. if we don't use the wrapper slot then set it to fragment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@wodenx , @hvanyo ,

Actually, the components Rewards, Social Links, and FooterMenus, already have a wrapper:

Still, do you think the wrappers should be added in the FooterCleanBase component, instead of in the components themselves?

For Copyright, I don't see a reason why it should have a wrapper... except for Penaten, which has the copyright made in different way, and for Zarbess, which has very customized copyright, I don't see wrappers for it in the other sites, or even in CanvasX/Bodiless. Is there any specific reason why we should add an wrapper for just text?

Copy link
Contributor

Choose a reason for hiding this comment

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

I want to add wrappers at least for any component which we expect to receive an editor (whether that is a flow container, plain text, or rich text). The reason is that it makes it easier to apply props to the editor (like a placeholder or nodeKey) without reaching in via withDesign as you'd have to do if we used 'withEditor...'. Also makes it easier to swap out the editor without changing the formatting applied to the wrapper.

This is already the stndard pattern for content areas which take flow containers, just want to make it consistent for other editors.

I suppose an alternative would be to have all our editors provide their own wrappers... We can discuss at standup today.

Copy link
Contributor

Choose a reason for hiding this comment

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

For all those components which "already hve a wrapper" -- we should pass props from the top-level "clean" component to the wrapper to faciltate layout styling in a parent component.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@wodenx ,

As aligned in the standup, added wrappers to all the components and updated styles to reflect it. Please, review it again, thanks.

const Base = asGlobalFooterToken({
Components: {
Wrapper: startWith(Div),
Rewards: flowHoc(
Copy link
Contributor

Choose a reason for hiding this comment

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

Components domain should not have anything except tokens from other components. I think all the stylin gon the wrapper here shoudl go into a cxRewards token (why isn' tit in Default, anyway?)

Copy link
Contributor

Choose a reason for hiding this comment

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

if this styling is not appropriate for cxRewards.default, then it should go into other domains (layout, spacing). And, we should either pass the component props to the wrapper (in cxRewards), or have a RewardsWrapper slot here. @hvanyo thoughts on passing clean component props to its outer wrapper, eg:

const MyComponentClean = ({ components: C, ...rest }) -> (
  <C.Wrapper {...rest}>
     ...
     ```

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@wodenx ,

IMO, that style shouldn't be in the cxRewards Default, since it seems more something for the slots design than for the rewards component itself. I mean, suppose we want to reuse the rewards component somewhere else than in the footer (in a page for example), that spacing/layout will not probably make sense.

The same works in the other way, suppose we have to replace the Rewards with another component, I can just switch the component in the slot (which makes me wonder if we should have the slot names as Rewards) and the new component would be in the same place without rewriting the same style inside the component.

Well, right now, since it seems we are waiting @hvanyo to answer about passing the component props to the wrapper, I just updated styling to be in the proper domains (layout, spacing).

Please, take a look if that's okay for now. Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@wodenx ,

As aligned in the standup, applied wrapper in the slots instead of using props.


import { withNode, withNodeKey } from '@bodiless/core';
import { cxColor, cxFontSize } from '@bodiless/cx-elements';
import { withEditorFull } from '@bodiless/cx-editors';
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to avoid withEditor... and instead provide slots in the top level component for editors. cc @hvanyo

Copy link
Collaborator

Choose a reason for hiding this comment

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

we need to start righting the best practices down

Copy link
Contributor

Choose a reason for hiding this comment

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

},
Schema: {
FooterMenus: flowHoc(
withNode,
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need these calls to withNode?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hello @wodenx ,

I think we do. Maybe you have another idea, but just for you to understand, if I just provide the withNodeKey, the data is saved inside the pages directory, instead of the site directory. Also, without the withNode, the file names don't contain the key FooterMenus. Is that okay to keep it then?

Copy link
Contributor

Choose a reason for hiding this comment

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

ok. but i would like to wrap th ewhole footer in a node and give it a "footer" node key - then the menus and other compoennts inside will be automatically namespaced, so the "FooterMenu" can just be "menu".

I;d also like to avoid mixed-case node keys, to avoid possible problems on systems with different casing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@wodenx ,

Updated "FooterMenu" key to "footer". Also, did the same for "Copyright" (turned into "copyright").

Theme: {
Wrapper: cxColor.BgSecondaryFooter,
},
Editors: {
Copy link
Contributor

Choose a reason for hiding this comment

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

So if we hvae a then this would just be (cxEditors.Copyright) or, if we don't want to make that a global RichText token, it would be cxFooterEditors.Copyright (a token defined somewhere in this package)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

IMO, this is very specific for footer, I don't see a reason to make it global.

@wodenx , @hvanyo , want to discuss this a little before the change?

Copy link
Contributor

Choose a reason for hiding this comment

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

to me it's a question of where we want it to appear in the styleguide - do we want the "editors" page of the styleguide to have a "Copyright" token which can be appied to show how the editor looks for copyrigth? cc @hvanyo

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addreess. Please, review it again.

@@ -0,0 +1,102 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs to follow standard structure:

components/Footer/
  FooterClean.tsx
  index.ts. # imports default from tokens and exports as cxFooter
  tokens/
     cxFooter.ts. # default export is token collection
     index.ts # just re-imports and re-exports default export
  

Copy link
Contributor

Choose a reason for hiding this comment

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

Then we can add static tokens.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@wodenx ,

This has been addressed. Please, review it again, thanks!

wodenx
wodenx previously approved these changes Mar 15, 2022
wodenx
wodenx previously approved these changes Mar 15, 2022
paragraph: as(
cxColor.TextPrimaryFooterCopy,
cxFontSize.XS,
'border-white-400 border-t border-b md:border-0 lg:text-m-xs',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
'border-white-400 border-t border-b md:border-0 lg:text-m-xs',
'border-white-400 border-t border-b md:border-0',

Copy link
Collaborator

@hvanyo hvanyo Mar 15, 2022

Choose a reason for hiding this comment

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

and it looks this copyright editor is also getting cxFontSize.BaseSize from original RTE we need to remove.
2022-03-15_17-56-49

Same thing is happening for Links

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This has been addressed in this PR: Guilherme-Almeida-Zeni#10

cxColor.TextPrimaryFooterCopy,
cxTextDecoration.Bold,
// @todo should we use tokens here?
'text-m-xl md:text-m-lg lg:text-base',
Copy link
Collaborator

Choose a reason for hiding this comment

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

@guilhermegpessoa
Please convert these to use tokens inscope of this ticket.

/**
* An element token which adds a separator border to a footer menu item.
*/
const FooterMenu = asElementToken({
Copy link
Collaborator

Choose a reason for hiding this comment

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

@guilhermegpessoa This should be named Separator and not FooterMenu

Theme: {
Title: as(
cxColor.TextPrimaryFooterCopy,
'text-base',
Copy link
Collaborator

Choose a reason for hiding this comment

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

@guilhermegpessoa please use tokens here.

@Guilherme-Almeida-Zeni Guilherme-Almeida-Zeni changed the title feature(bc-footer): Add Brand.com Footer feat(bc-footer): Add Brand.com Footer Mar 18, 2022
* bugfix(bc-footer): Fix Footer Issues

* Remove top margin from in footnote

* Add uppercase to submenu items

* Removing unused imports

* bugfix(bc-footer): Fix comments on PR

* bugfix(bc-footer): Fix link issues

Co-authored-by: Guilherme Zeni <gzeni@its.jnj.com>
Co-authored-by: guilhermegpessoa <guilherme.gpessoa@hotmail.com>
Guilherme Zeni and others added 9 commits March 21, 2022 16:42
* fix(bc-footer): Fix padding issues

* fix(bc-footer) Fix padding values

* fix(bc-footer): Fix padding issues
* bugfix(bc-footer): Fix Footer Menu Accessibility Issues

* bugfix(bc-footer): Add External And Download Icons To Menu Title Links

Co-authored-by: Guilherme Zeni <gzeni@its.jnj.com>
Co-authored-by: Guilherme Zeni <gzeni@its.jnj.com>
@hvanyo hvanyo merged commit 9025ae5 into johnsonandjohnson:main Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Brand.Com Footer
5 participants