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

Re-home Simorgh Figure in Psammead #220

Merged
merged 30 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6657ad1
WIP
radiocontrolled Dec 17, 2018
6104144
figure component and merge latest
radiocontrolled Dec 17, 2018
b713869
remove package-locks
radiocontrolled Dec 17, 2018
9f0c163
remove package-lock psammead-copyright
radiocontrolled Dec 17, 2018
35e94b2
add documentation
radiocontrolled Dec 17, 2018
c1200f5
Merge branch 'latest' into add-figure
radiocontrolled Dec 17, 2018
dbb51a6
update readme
radiocontrolled Dec 17, 2018
76c17f8
Merge branch 'latest' of github.com:bbc-news/psammead into add-figure
radiocontrolled Dec 17, 2018
c972038
Merge branch 'add-figure' of github.com:bbc-news/psammead into add-fi…
radiocontrolled Dec 17, 2018
68d7806
add react to psammead-figure
radiocontrolled Dec 18, 2018
9f1f299
Update packages/components/psammead-figure/package.json
Dec 18, 2018
309fd70
Merge branch 'latest' into add-figure
radiocontrolled Dec 18, 2018
1438c19
Merge branch 'latest' into add-figure
radiocontrolled Dec 18, 2018
b7beb29
update package-lock
radiocontrolled Dec 18, 2018
6734179
Update packages/components/psammead-figure/README.md
sareh Dec 18, 2018
77c75f6
fix missing padding in figure snapshot
radiocontrolled Dec 18, 2018
5761c7d
Merge branch 'latest' into add-figure
radiocontrolled Dec 18, 2018
a42b7f7
Merge branch 'latest' into add-figure
radiocontrolled Dec 19, 2018
9968090
Update packages/components/psammead-figure/README.md
ChrisBAshton Dec 19, 2018
c6c152b
storybook story
radiocontrolled Dec 19, 2018
6f6709f
Merge branch 'add-figure' of github.com:bbc-news/psammead into add-fi…
radiocontrolled Dec 19, 2018
2751f75
Merge branch 'latest' into add-figure
radiocontrolled Dec 19, 2018
3d3e58b
Update packages/components/psammead-figure/README.md
ChrisBAshton Dec 19, 2018
e7da145
Update packages/components/psammead-figure/README.md
sareh Dec 19, 2018
b906d57
remove height from image in story
radiocontrolled Dec 19, 2018
e8b9e61
Merge branch 'latest' into add-figure
sareh Dec 19, 2018
5215a37
Update packages/components/psammead-figure/src/index.stories.jsx
ChrisBAshton Dec 20, 2018
f1ef98a
update story and documentation
radiocontrolled Dec 20, 2018
20963bb
change to spelling
radiocontrolled Dec 20, 2018
6bdb30f
Merge branch 'latest' into add-figure
jamesbrumpton Dec 20, 2018
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
5 changes: 5 additions & 0 deletions packages/components/psammead-figure/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Psammead Figure Changelog

| Version | Description |
|---------|-------------|
| 0.1.0 | [PR#220](https://github.com/BBC-News/psammead/pull/220) Create initial package with Figure component pulled in from [Simorgh](https://github.com/BBC-News/simorgh). |
51 changes: 51 additions & 0 deletions packages/components/psammead-figure/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# psammead-figure · [![Storybook](https://github.com/storybooks/press/blob/master/badges/storybook.svg)](https://bbc-news.github.io/psammead/?selectedKind=Figure) [![GitHub license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/BBC-News/psammead/blob/latest/LICENSE) [![npm version](https://img.shields.io/npm/v/@bbc/psammead-figure.svg)](https://www.npmjs.com/package/@bbc/psammead-figure) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/BBC-News/psammead/blob/latest/CONTRIBUTING.md)

## Description

The `psammead-figure` component is a styled `<figure>` element.

## When to use this component

Use this component when a `<figure>` element, which represents self-contained content that frequently has a caption, is required. Figures usually wrap an image.
ChrisBAshton marked this conversation as resolved.
Show resolved Hide resolved

The following example shows `psammead-figure` wrapping an
* [psammead-image-placeholder](https://github.com/BBC-News/psammead/tree/latest/packages/components/psammead-image-placeholder), a `<div>` with background image
* [psammead-image](https://github.com/BBC-News/psammead/tree/latest/packages/components/psammead-image), an `<img>`
* [psammead-caption](https://github.com/BBC-News/psammead/tree/latest/packages/components/psammead-caption), a `<figcaption>`
* [psammead-visually-hidden-text](https://github.com/BBC-News/psammead/tree/latest/packages/components/psammead-visually-hidden-text), a hidden `<span>` available only to assistive technology

```jsx
import Caption from '@bbc/psammead-caption';
import Figure from '@bbc/psammead-figure';
import Image from '@bbc/psammead-image';
import ImagePlaceholder from '@bbc/psammead-image-placeholder';
import VisuallyHiddenText from '@bbc/psammead-visually-hidden-text';

const Wrapper = ({ src, alt, ratio, captionText }) => (
<Figure>
<ImagePlaceholder ratio={ratio}>
<Image alt={alt} src={src} />
</ImagePlaceholder>
<Caption>
<VisuallyHiddenText>Image caption, </VisuallyHiddenText>
{captionText}
</Caption>
</Figure>
);
```

## Accessibility notes

The `psammead-figure` is a `<figure>` element with associated styles. When you use this component, it has the same semantic meaning as a regular [figure](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figure) element.

## 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 respository](https://github.com/BBC-News/psammead/blob/latest/CONTRIBUTING.md).

### [Code of Conduct](https://github.com/BBC-News/psammead/blob/latest/CODE_OF_CONDUCT.md)

We welcome feedback and help on this work. By participating in this project, you agree to abide by the [code of conduct](https://github.com/BBC-News/psammead/blob/latest/CODE_OF_CONDUCT.md). Please take a moment to read it.

### License

Psammead is [Apache 2.0 licensed](https://github.com/BBC-News/psammead/blob/latest/LICENSE).
Loading