New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@home-app/image.component

Package Overview
Dependencies
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@home-app/image.component

An image component that load an appropriate sized image by itself.

  • 3.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
4
Weekly downloads
 
Created
Source

Image

An image component that load an appropriate sized image by itself.

This component works with googleCloud images only!

How to use

Install:

yarn add @home-app/image.component

Import:

import Image from "@home-app/image.component";

Use:

const baseURL = 'http://...';

const TABLET_WIDTH = 768;
const DESKTOP_WIDTH = 1024;
const LARGE_DESKTOP = 1440;
// it`s an object that contains mapping a screen width onto the image dimensions
const mediaDimensions = {
  [TABLET_WIDTH]: 500, // it means that for a media 'max-width: 767px' will be loaded an image with width=500px and proportionally resized height
  [DESKTOP_WIDTH]: {width: 900, height: 400}, // the image will be resized and cropped
  [LARGE_DESKTOP]: {height: 400}, // width will be proportionally resized to the specified height  
};

// ... some code

<Image src={baseURL} alt='' dimensions={mediaDimensions} />

NB:

  • For that will not be caught by media queries the baseUrl will be used. So, it means if an 200px width is used as a base, it will be dramatically blurred on a 1500px screen... It is strongly recommended to use high resolution images for a base.

FAQs

Package last updated on 18 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc