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 4 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 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#]() Use withServicesKnob `selectedService` prop |
Bopchy marked this conversation as resolved.
Show resolved Hide resolved
| 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
10 changes: 5 additions & 5 deletions packages/components/psammead-most-read/src/index.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { storiesOf } from '@storybook/react';
import { select, boolean, text, 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';

Expand Down Expand Up @@ -93,11 +93,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 +110,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#]() Use withServicesKnob `selectedService` prop |
Bopchy marked this conversation as resolved.
Show resolved Hide resolved
| 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