@bbc/psammead-sitewide-links
Advanced tools
Comparing version
@@ -6,2 +6,3 @@ # Psammead Sitewide Links Changelog | ||
|---------|-------------| | ||
| 0.3.10 | [PR#585](https://github.com/bbc/psammead/pull/604) Remove nanoid package usage for generating list item keys | | ||
| 0.3.9 | [PR#585](https://github.com/bbc/psammead/pull/585) Make row count dynamic on number of columns and items | | ||
@@ -8,0 +9,0 @@ | 0.3.8 | [PR#576](https://github.com/bbc/psammead/pull/576) Display list in a single column under 240px | |
@@ -14,4 +14,2 @@ "use strict"; | ||
var _nanoid = _interopRequireDefault(require("nanoid")); | ||
var _colours = require("@bbc/psammead-styles/colours"); | ||
@@ -61,3 +59,3 @@ | ||
return _react["default"].createElement(StyledListItem, { | ||
key: (0, _nanoid["default"])(), | ||
key: link.text, | ||
role: "listitem" | ||
@@ -64,0 +62,0 @@ }, _react["default"].createElement(_Link["default"], { |
{ | ||
"name": "@bbc/psammead-sitewide-links", | ||
"version": "0.3.9", | ||
"version": "0.3.10", | ||
"description": "React styled component for a sitewide-links", | ||
@@ -27,4 +27,3 @@ "main": "dist/index.js", | ||
"@bbc/gel-foundations": "^0.3.0", | ||
"@bbc/psammead-styles": "^0.3.2", | ||
"nanoid": "^2.0.0" | ||
"@bbc/psammead-styles": "^0.3.2" | ||
}, | ||
@@ -31,0 +30,0 @@ "devDependencies": { |
@@ -8,10 +8,13 @@ import React from 'react'; | ||
const buildLink = text => ({ | ||
href: 'https://www.bbc.co.uk/news', | ||
text, | ||
}); | ||
const buildLink = (text, index) => { | ||
const linkText = index >= 0 ? `${text} ${index}` : text; | ||
return { | ||
href: 'https://www.bbc.co.uk/news', | ||
text: linkText, | ||
}; | ||
}; | ||
const linkNames = [1, 2, 3, 4, 5, 6, 7].map(n => ({ | ||
name: `Link ${n}`, | ||
defaultText: `link ${n}`, | ||
defaultText: 'link', | ||
})); | ||
@@ -18,0 +21,0 @@ linkNames.unshift( |
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { string, arrayOf, shape } from 'prop-types'; | ||
import nanoid from 'nanoid'; | ||
import { C_SHADOW } from '@bbc/psammead-styles/colours'; | ||
@@ -88,3 +87,3 @@ import { GEL_SPACING, GEL_SPACING_DBL } from '@bbc/gel-foundations/spacings'; | ||
{links.map(link => ( | ||
<StyledListItem key={nanoid()} role="listitem"> | ||
<StyledListItem key={link.text} role="listitem"> | ||
<Link text={link.text} href={link.href} /> | ||
@@ -91,0 +90,0 @@ </StyledListItem> |
36050
0.25%5
-16.67%443
0.23%- Removed
- Removed