Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@crave/farmblocks-image

CraveFood43MIT3.2.12

A react component for thumbnail images

readme

logo-farmblocks

Farmblocks-Image

A React component for thumbnail images. See Storybook

Installation

npm install @crave/farmblocks-image

Spec

See it on zeplin: Thumbnails: https://scene.zeplin.io/project/595a9cd3b401bf1876faab27/screen/59f0df2fee4fbc85eccb17b1 Badges: https://scene.zeplin.io/project/595a9cd3b401bf1876faab27/screen/59f0df31bbc93198a853bbe2

Usage

import React from "react";
import ReactDOM from "react-dom";
import Image, { thumbnailSizes, badgeSizes } from "@crave/farmblocks-image";

const root = document.createElement("div");

const imageUrl =
  "https://openclipart.org/image/300px/svg_to_png/290343/1510649016.png&disposition=attachment";

ReactDOM.render(<Image src={imageUrl} size={badgeSizes.LARGE} badge />, root);

document.body.appendChild(root);

API

Property Description Type
src required, the URL of the image string
badge make the image a circle boolean
borderRadius the border radius of the image (it will be ignored if the badge prop is true) string or number
fit how should the image fit the size (same options that the object-fit css attribute) string
height the height of the image string or number
size if your image uses the same size in pixels for width and height, you can use this shorthand number
width the width of the image string

Table of sizes

Type Value Size result
badge - extra small badgeSizes.X_SMALL 16 px
badge - small badgeSizes.SMALL 24 px
badge - medium badgeSizes.MEDIUM 40 px
badge - large badgeSizes.LARGE 56 px
thumbnail - small thumbnailSizes.SMALL 40 px
thumbnail - medium thumbnailSizes.MEDIUM 48 px
thumbnail - large thumbnailSizes.LARGE 72 px
thumbnail - extra large thumbnailSizes.X_LARGE 120 px
thumbnail - huge thumbnailSizes.HUGE 240 px

License

MIT

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

3.2.12 (2022-01-05)

Note: Version bump only for package @crave/farmblocks-image

3.2.11 (2021-08-11)

Note: Version bump only for package @crave/farmblocks-image

3.2.10 (2021-07-26)

Note: Version bump only for package @crave/farmblocks-image

3.2.9 (2021-07-26)

Note: Version bump only for package @crave/farmblocks-image

3.2.8 (2021-07-23)

Note: Version bump only for package @crave/farmblocks-image

3.2.7 (2021-07-07)

Note: Version bump only for package @crave/farmblocks-image

3.2.6 (2021-04-19)

Note: Version bump only for package @crave/farmblocks-image

3.2.5 (2020-10-21)

Bug Fixes

  • constants: named exports (b26b409)

3.2.4 (2020-09-04)

Note: Version bump only for package @crave/farmblocks-image

3.2.3 (2020-03-06)

Note: Version bump only for package @crave/farmblocks-image

3.2.2 (2020-02-04)

Note: Version bump only for package @crave/farmblocks-image

3.2.1 (2020-01-08)

Note: Version bump only for package @crave/farmblocks-image

3.2.0 (2019-12-27)

Features

  • Image: add withBoxShadow property (febbf32)

3.1.2 (2019-12-03)

Note: Version bump only for package @crave/farmblocks-image

3.1.1 (2019-11-27)

Note: Version bump only for package @crave/farmblocks-image

3.1.0 (2019-11-13)

Features

  • sidenav: export package components (1ab6c94)

3.0.2 (2019-10-31)

Note: Version bump only for package @crave/farmblocks-image

3.0.1 (2019-10-18)

Bug Fixes

  • Image: proptypes width and height could be a number value (9663a9c)

3.0.0 (2019-10-01)

Bug Fixes

  • Image: remove orverflow hidden from default image styles (84f349f), closes #916

BREAKING CHANGES

  • Image: overflow hidden isnt default anymore

2.0.0 (2019-09-16)

Features

  • Image: replace div/background-image by img element (b3885fc), closes #892
  • Image/story: Remove deprecated stories and replace fit stories (801d577)
  • README: Update properties docs and sort it by required then alphabetically (efb8291)

BREAKING CHANGES

  • Image: removed border prop

1.2.6 (2019-09-10)

Note: Version bump only for package @crave/farmblocks-image

1.2.5 (2019-07-09)

Note: Version bump only for package @crave/farmblocks-image

1.2.4 (2019-04-25)

Note: Version bump only for package @crave/farmblocks-image

1.2.3 (2019-04-03)

Note: Version bump only for package @crave/farmblocks-image

1.2.2 (2019-03-08)

Note: Version bump only for package @crave/farmblocks-image

1.2.1 (2019-03-07)

Note: Version bump only for package @crave/farmblocks-image

1.2.0 (2019-02-18)

Features

  • package.json: update react and related packages (b34fbee), closes #693

1.1.1 (2019-02-13)

Note: Version bump only for package @crave/farmblocks-image

1.1.0 (2019-01-14)

Features

  • updated all dependencies to their latest versions (908663c), closes #667

1.0.2 (2019-01-03)

Note: Version bump only for package @crave/farmblocks-image

1.0.1 (2018-11-21)

Note: Version bump only for package @crave/farmblocks-image

1.0.0 (2018-10-29)

Features

  • package.json: upgrade styled-components to v4 (b5c195a), closes #592
  • update styled-components: update peer dependency for all packages (ae80edf)

BREAKING CHANGES

  • update styled-components: Requires React ^v16.6.0

0.5.0 (2018-10-19)

Features

0.4.5 (2018-09-19)

Bug Fixes

  • updated styled-components to 3.4.9 peer-dependency on all packages (c648df4)

0.4.4 (2018-09-18)

Note: Version bump only for package @crave/farmblocks-image

0.4.3 (2018-06-18)

Note: Version bump only for package @crave/farmblocks-image

0.4.2 (2018-06-12)

Note: Version bump only for package @crave/farmblocks-image

0.4.1 (2018-04-11)

Note: Version bump only for package @crave/farmblocks-image

0.4.0 (2018-03-23)

Features

  • image: add new properties width, height, border, and update docs (28e3d75)

0.3.4 (2018-02-14)

Note: Version bump only for package @crave/farmblocks-image

0.3.3 (2018-02-08)

Bug Fixes

  • image: fix div dimensions on Image component (75409d8)

0.3.2 (2018-01-29)

Note: Version bump only for package @crave/farmblocks-image

0.3.1 (2018-01-04)

Bug Fixes

  • Image fitModes: export fitModes at Image index (bd8734c)

0.3.0 (2018-01-03)

Features

  • Image: add prop "fit" to Image component (ac1a9d7)

0.2.4 (2017-12-07)

Bug Fixes

  • licenses: fix the year and add missing license files (03a0c2b)

0.2.3 (2017-12-07)

Note: Version bump only for package @crave/farmblocks-image

0.2.2 (2017-12-07)

Note: Version bump only for package @crave/farmblocks-image

0.2.1 (2017-11-20)

Note: Version bump only for package @crave/farmblocks-image

0.2.0 (2017-11-14)

Bug Fixes

  • dependencies: include farmblocks-theme on the dependencies of the package (aedeb34)
  • style: badge border width change at a different limit than thumbnail (eb41979)

Features

  • image: styled image based on specs (a60647e)
  • package: initial files (3780dbd)