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

Use selectedService prop in psammead-radio-schedules & psammead-most-read stories #3291

Merged
merged 15 commits into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
|---------|-------------|
| 2.0.110 | [PR#3291](https://github.com/bbc/psammead/pull/3291) Bump `@psammead-storybook-helpers` |
| 2.0.109 | [PR#3292](https://github.com/bbc/psammead/pull/3292) Talos - Bump Dependencies - @bbc/psammead-navigation, @bbc/psammead-section-label |
| 2.0.108 | [PR#3217](https://github.com/bbc/psammead/pull/3217) Add @loadable/component to devDependencies for @bbc/psammead-social-embed. |
| 2.0.107 | [PR#3274](https://github.com/bbc/psammead/pull/3274) Talos - Bump Dependencies - @bbc/psammead-calendars, @bbc/psammead-timestamp-container |
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead",
"version": "2.0.109",
"version": "2.0.110",
"description": "Core Components Library Developed & Maintained By The Articles and Reach & Languages Team",
"main": "index.js",
"private": true,
Expand Down Expand Up @@ -82,7 +82,7 @@
"@bbc/psammead-sitewide-links": "^4.0.10",
"@bbc/psammead-story-promo": "^5.1.0",
"@bbc/psammead-story-promo-list": "^4.0.5",
"@bbc/psammead-storybook-helpers": "^8.2.5",
"@bbc/psammead-storybook-helpers": "^8.2.6",
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this was bumped up, CHANGELOG.md should be updated in psammead too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The CHANGELOG, package-lock.json and package.json are now updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed updates to CHANGELOG, package-lock.json and package.json as since the version change in psammead-stoybook-helpers is minor, the changes in the package are already in use. This means psammead-stoybook-helpers doesn't need to be upgraded && this resolves the issue highlighted above

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for the updates 👍 I can still see some changes in package-lock.json though, Jenkins should stop complaining after you remove 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.

My statement above was a bit off. Since the minor change is still being noted and being installed, an update to the CHANGELOG and version numbers is still required.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good. Can you make sure that psammead-storybook-helpers version is bumped up in package.json too, not just in package-lock.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bumped the version. Sorry for the back and forth.

"@bbc/psammead-styles": "^4.3.0",
"@bbc/psammead-test-helpers": "^3.1.3",
"@bbc/psammead-timestamp": "^2.2.26",
Expand Down
1 change: 1 addition & 0 deletions packages/components/psammead-most-read/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
|---------|-------------|
| 4.0.3 | [PR#3291](https://github.com/bbc/psammead/pull/3291) Use withServicesKnob `selectedService` prop |
| 4.0.2 | [PR#3243](https://github.com/bbc/psammead/pull/3243) Fixes most-read IE11 `oneColumn` layout bugs |
| 4.0.1 | [PR#3237](https://github.com/bbc/psammead/pull/3237) Fixed most-read IE layout bug |
| 4.0.0 | [PR#3201](https://github.com/bbc/psammead/pull/3201) Refactor RankWrapper in MostRead |
Expand Down
2 changes: 1 addition & 1 deletion packages/components/psammead-most-read/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/components/psammead-most-read/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead-most-read",
"version": "4.0.2",
"version": "4.0.3",
"description": "A component for the most read item",
"main": "dist/index.js",
"module": "esm/index.js",
Expand Down
18 changes: 11 additions & 7 deletions packages/components/psammead-most-read/src/index.stories.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
/* eslint-disable react/prop-types */
import React from 'react';
import { storiesOf } from '@storybook/react';
import { select, boolean, text, withKnobs } from '@storybook/addon-knobs';
import { select, boolean, number, withKnobs } from '@storybook/addon-knobs';
import { withServicesKnob } from '@bbc/psammead-storybook-helpers';
import { getItem, getItemWrapperArray, getServiceVariant } from './utilities';
import { getItem, getItemWrapperArray } from './utilities';
import { MostReadRank, MostReadLink, MostReadList } from './index';
import notes from '../README.md';

const newsServiceDecorator = withServicesKnob({
defaultService: 'news',
});
const listIndexRange = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice one 👍

min: 1,
max: 10,
};

const pageTypes = ['oneColumn', 'twoColumn', 'multiColumn'];

Expand Down Expand Up @@ -79,7 +83,7 @@ storiesOf('Components|MostRead/Rank', module)
dir,
service,
script,
listIndex: text('Number (1 - 10)', '5'),
listIndex: number('Number (1 - 10)', 5, listIndexRange),
numberOfItems: 10,
}),
{
Expand All @@ -93,11 +97,11 @@ storiesOf('Components|MostRead/Item', module)
.addDecorator(withServicesKnob())
.add(
`default`,
({ dir, script, service, variant }) =>
({ dir, script, selectedService }) =>
renderLink({
dir,
script,
service: getServiceVariant({ service, variant }),
service: selectedService,
withTimestamp: boolean('Timestamp', false),
}),
{
Expand All @@ -110,12 +114,12 @@ storiesOf('Components|MostRead/List', module)
.add(
`default`,
() =>
newsServiceDecorator(({ dir, script, service, variant }) =>
newsServiceDecorator(({ dir, script, selectedService }) =>
renderList({
numberOfItems: 10,
columnLayout: select('Page Type (columns)', pageTypes, 'multiColumn'),
withTimestamp: boolean('Timestamp', false),
service: getServiceVariant({ service, variant }),
service: selectedService,
dir,
script,
}),
Expand Down
10 changes: 0 additions & 10 deletions packages/components/psammead-most-read/src/utilities/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ const lastUpdated = ({ script, service }) => (
</Timestamp>
);

export const getServiceVariant = ({ service, variant = '' }) => {
if (variant !== 'default') {
const variantOverride =
variant.charAt(0).toUpperCase() + variant.substring(1);
return service + variantOverride;
}

return service;
};

export const getItem = ({ service, withTimestamp = false }) => {
const baseUrl = 'https://www.bbc.com';
const { text, articlePath } = TEXT_VARIANTS[service];
Expand Down
1 change: 1 addition & 0 deletions packages/components/psammead-radio-schedule/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
|---------|-------------|
| 0.1.0-alpha.23 | [PR#3291](https://github.com/bbc/psammead/pull/3291) Use withServicesKnob `selectedService` prop |
| 0.1.0-alpha.22 | [PR#3274](https://github.com/bbc/psammead/pull/3274) Talos - Bump Dependencies - @bbc/psammead-timestamp-container |
| 0.1.0-alpha.21 | [PR#3272](https://github.com/bbc/psammead/pull/3272) Talos - Bump Dependencies - @bbc/psammead-timestamp-container |
| 0.1.0-alpha.20 | [PR#3242](https://github.com/bbc/psammead/pull/3242) Add padding bottom to program cards |
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/components/psammead-radio-schedule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead-radio-schedule",
"version": "0.1.0-alpha.22",
"version": "0.1.0-alpha.23",
"main": "dist/index.js",
"module": "esm/index.js",
"sideEffects": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('RadioSchedule', () => {
script: arabic,
dir: 'rtl',
locale: 'fa',
selectedService: 'arabic',
}),
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ export const renderRadioSchedule = ({
script = latin,
dir = 'ltr',
withLongSummary = false,
selectedService = 'news',
}) => (
<RadioSchedule
schedules={getSchedule(service, withLongSummary)}
schedules={getSchedule(selectedService, withLongSummary)}
locale={locale}
timezone={timezone}
script={script}
Expand Down