Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Update psammead-navigation to require colours as props #4187

Merged
merged 23 commits into from
Jan 14, 2021

Conversation

jimjohnsonrollings
Copy link
Contributor

@jimjohnsonrollings jimjohnsonrollings commented Jan 6, 2021

Resolves #3123

Overall change:
Upgrades psammead-navigation so that it will work for non-Red brands

Code changes:

  • Update the transparent fade in ScrollableNavigation to work with a variable colour
  • Update many components to take new props for required colours
  • Use the brandBackgroundColour prop to set the background of the navigation
  • Use the brandBackgroundColour for the fade in ScrollableNavigation, including adding a new function to generate the value for the transparency
  • Use the brandBorderColour for the separator line where the nav wraps onto a second row
  • Use the brandHighlightColour for the current page indicator, and the hover/active state borders
  • Use the brandForegroundColour for the text in the nav
  • In Storybook, use the colours specified for the service selected in the knobs
  • Remove now unnecessary colour imports
  • Update tests
  • Update snapshots
  • Bump version to 9.0.0 as this is a breaking change
  • Update readme

Testing notes

In Storybook, this can be tested by viewing the Navigation stories and changing the service drop-down to Sport, which has different values to News for all colours

Screenshots
Screenshots from Storybook with news and sport selected
Screenshot 2021-01-12 at 09 43 22
Screenshot 2021-01-12 at 09 43 34
Screenshot 2021-01-12 at 09 43 45
Screenshot 2021-01-12 at 09 43 54
Screenshot 2021-01-12 at 09 44 09
Screenshot 2021-01-12 at 09 44 16


  • I have assigned myself to this PR and the corresponding issues
  • Automated jest tests added (for new features) or updated (for existing features)
  • This PR requires manual testing

@jimjohnsonrollings jimjohnsonrollings self-assigned this Jan 6, 2021
@jimjohnsonrollings jimjohnsonrollings added the cross-team For visibility for both World Service teams (Engage & Media) label Jan 6, 2021
@jimjohnsonrollings jimjohnsonrollings added ws-articles Tasks for the WS Articles Team and removed cross-team For visibility for both World Service teams (Engage & Media) labels Jan 7, 2021
@jimjohnsonrollings jimjohnsonrollings changed the title Navcolour Update psammead-navigation to require colours as props Jan 11, 2021
@jimjohnsonrollings jimjohnsonrollings marked this pull request as ready for review January 12, 2021 09:34

import notes from '../README.md';

const defaultBrandBackgroundColour = '#B80000';
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this use a constant here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is used for the background colour of the brand component when shown in storybook, not by the navigation component, so I didn't feel it was relevant to the change I was making.

@@ -21,6 +21,9 @@ const navigationUlComponent = (
currentPageText="Current page"
service="news"
data-navigation="test_navigation"
brandForegroundColour="#FDFDFD"
Copy link
Contributor

Choose a reason for hiding this comment

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

Throughout these tests I'd imagine the colours should refer to constants rather than being hardcoded?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What benefit would that give?

Copy link
Contributor

@andrewscfc andrewscfc left a comment

Choose a reason for hiding this comment

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

Thanks for the changes

@paruchurisilpa
Copy link
Contributor

LGTM..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ws-articles Tasks for the WS Articles Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update psammead-navigation to take in colours
4 participants