1.1.3 • Published 2 years ago

@bbc/psammead-topic-tags v1.1.3

Weekly downloads
42
License
Apache-2.0
Repository
github
Last release
2 years ago

psammead-topic-tags - Known Vulnerabilities Dependency Status peerDependencies Status Storybook GitHub license npm version PRs Welcome

Description

The TopicTags component is a styled <ul> or <div>, depending on the number of TopicTag components it contains. If there is only a single TopicTag component with the TopicTags component, then the TopicTags component is a styled <div>, otherwise it's a styled <ul>.

Installation

npm install @bbc/psammead-topic-tags --save

Props

ArgumentTypeRequiredDefaultExample
scriptstringYesN/A'news'
serviceobjectYesN/A{ canon: { groupA: { fontSize: '28', lineHeight: '32',}, groupB: { fontSize: '32', lineHeight: '36', }, groupD: { fontSize: '44', lineHeight: '48', }, }, trafalgar: { groupA: { fontSize: '20', lineHeight: '24', }, groupB: { fontSize: '24', lineHeight: '28', }, groupD: { fontSize: '32', lineHeight: '36', }, }, }
dirstringNo'ltr'One of 'ltr' or 'rtl'
tagBackgroundColourstringNoThe GEL variable C_LUNARAny valid CSS color

Usage

import { TopicTags, TopicTag } from '@bbc/psammead-topic-tags';
import { latin } from '@bbc/gel-foundations/scripts';

const Wrapper = () => (
  <TopicTags script={latin} service="news" dir="ltr">
    <TopicTag topicName="Retailing" topicLink="/url/to/topic" />
    <TopicTag topicName="Business" topicLink="/url/to/topic" />
    <TopicTag topicName="Viruses" topicLink="/url/to/topic" />
  </TopicTags>
);

When to use this component

The TopicTag component should only be used inside of a TopicTags component, and a TopicTags component should only be used to contain TopicTag components.

Accessibility notes

The TopicTags component is fundamentally a <ul> when there is more than 1 TopicTag, and the <ul> uses the ARIA role="list" attribute. This reinstates the list semantics on VoiceOver which removes them due to the use of list-style-type: none; in the CSS.

Contributing

Psammead is completely open source. We are grateful for any contributions, whether they be new components, bug fixes or general improvements. Please see our primary contributing guide which can be found at the root of the Psammead repository.

Code of Conduct

We welcome feedback and help on this work. By participating in this project, you agree to abide by the code of conduct. Please take a moment to read it.

License

Psammead is Apache 2.0 licensed.

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.0-alpha.10

3 years ago

0.1.0-alpha.11

3 years ago

0.1.0-alpha.9

3 years ago

0.1.0-alpha.8

3 years ago

0.1.0-alpha.7

3 years ago

0.1.0-alpha.6

3 years ago

0.1.0-alpha.5

3 years ago

0.1.0-alpha.4

3 years ago

0.1.0-alpha.3

3 years ago

0.1.0-alpha.2

3 years ago

0.1.0-alpha.1

3 years ago