Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sitestudio/atomic.aspect-ratio-image

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sitestudio/atomic.aspect-ratio-image - npm Package Compare versions

Comparing version 0.0.73 to 0.0.74

dist/preview-1731995750411.js

20

dist/aspect-ratio-image.js
import { jsx as _jsx } from "react/jsx-runtime";
import { useState } from 'react';
export function AspectRatioImage({ src, borderRadius, alt, }) {
const [aspectRatio, setAspectRatio] = useState('1/1');
return (_jsx("div", { className: "relative w-full h-full", style: { aspectRatio }, children: src && (
// eslint-disable-next-line react/jsx-no-undef
// <Image
// src={src}
// layout="fill"
// objectFit="contain"
// style={{ borderRadius }}
// onLoad={({ target }) => {
// const { naturalWidth, naturalHeight } = target as HTMLImageElement;
// setAspectRatio(`${naturalWidth} / ${naturalHeight}`);
// }}
// alt={alt || ''}
// />
_jsx("img", { src: src, style: { borderRadius }, onLoad: ({ target }) => {
const [aspectRatio, setAspectRatio] = useState(undefined);
return (_jsx("div", { className: "relative w-full h-full", style: aspectRatio ? { aspectRatio } : undefined, children: src && (_jsx("img", { src: src, style: { borderRadius }, onLoad: ({ target }) => {
const { naturalWidth, naturalHeight } = target;
setAspectRatio(`${naturalWidth} / ${naturalHeight}`);
}, alt: alt || '' })) }));
}, alt: alt || '', className: "w-full h-full object-cover" // Ensure proper scaling
})) }));
}
//# sourceMappingURL=aspect-ratio-image.js.map

4

package.json
{
"name": "@sitestudio/atomic.aspect-ratio-image",
"version": "0.0.73",
"version": "0.0.74",
"homepage": "https://bit.cloud/sitestudio/atomic/aspect-ratio-image",

@@ -9,3 +9,3 @@ "main": "dist/index.js",

"name": "aspect-ratio-image",
"version": "0.0.73"
"version": "0.0.74"
},

@@ -12,0 +12,0 @@ "dependencies": {},

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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