1.0.34 • Published 2 years ago

@asurraa/sura-ui-image-viewer v1.0.34

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Storybook

@asurraa/sura-ui-image-viewer

Sura UI Image Viewer Component

This component is used to preview images.

Installation

With Yarn

yarn add @asurraa/sura-ui-image-viewer

Interface

export type AsurRaaImageViewerProps = {
  value: string | undefined;
  isPreview?: boolean;
  primitiveImageProps?: ImageProps;
};

Usage

  1. Image Viewer Provider (Wrap)
// app.tsx
import react from "react";
import App from "./App";
import { AsurRaaImageViewerProvider } from "@asurraa/sura-ui-image-viewer";

const PackageProvider = () => {
  return (
    <div>
      // ... wrap within the top component wrapper
      <AsurRaaImageViewerProvider
        imageUrl={returnImageRoute}
        fallbackImage={fallBackImage}
      >
        <App />
      </AsurRaaImageViewerProvider>
    </div>
  );
};
  1. Image Viewer
import { Card, CardProps, Tag, Typography } from "antd";
import { FC, Fragment } from "react";
import { AsurRaaImageViewer } from "@asurraa/sura-ui-image-viewer";

export interface SaleCardProps {
  antdCardProps?: CardProps;
  title: string;
  extra: string | number;
  description: string;
  image: string;
}

const SaleCard: FC<SaleCardProps> = (props) => {
  return (
    <Fragment>
      <Card
        style={{
          cursor: "pointer",
          boxShadow: "2px 2px 10px 2px rgba(208, 216, 243, 0.6)",
        }}
        title={<Typography.Text strong>{props.title}</Typography.Text>}
        bordered={true}
        extra={<Tag color="green">{props.extra}</Tag>}
        {...props.antdCardProps}
      >
        <div
          style={{
            display: "flex",
            justifyContent: "space-around",
          }}
        >
          <AsurRaaImageViewer isPreview={false} value={props.image} />
          {/* <img src={props.image} /> */}
          <div>
            <p style={{ opacity: 0.7, textAlign: "center" }}>
              {props.description}
            </p>
          </div>
        </div>
      </Card>
    </Fragment>
  );
};

export default SaleCard;

note with tailwindcss

img {
  display: unset !important;
}
1.0.29

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.34

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.16

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.5

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago