0.0.10-alpha.4 • Published 7 months ago

@originvault/ov-content-viewer v0.0.10-alpha.4

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@originvault/ov-content-viewer🪟

OVContentViewer is a React component designed to display content in a versatile viewer. It supports full-screen mode, hover effects, and customizable rendering of resources. This component is particularly useful for displaying images and other media types in a user-friendly interface.

Features

  • Full-screen toggle functionality
  • Hoverable icons for additional actions
  • Customizable rendering of content
  • Support for dark mode
  • Responsive design for mobile devices

Installation

To use the OVContentViewer component in your project, follow these steps:

  1. Install Dependencies: Make sure you have React and Material-UI installed in your project. If you haven't installed them yet, you can do so using npm or yarn:

    npm install @mui/material @mui/icons-material

    or

    yarn add @mui/material @mui/icons-material
  2. Add the Component: Import the OVContentViewer component into your desired file:

    import { OVContentViewer } from '@originvault/ov-content-viewer';

Usage

Here’s a basic example of how to use the OVContentViewer component:

import React from 'react';
import { OVContentViewer } from '@originvault/ov-content-viewer';

const App = () => {
  return (
    <OVContentViewer
      did="your-did-here"
      src="your-image-url-here"
      title="Your Title"
      isDarkMode={false}
      hideOriginInfoIcon={false}
      type="image/png"
      alt="Description of the content"
      isFullScreen={false}
      setIsFullScreen={(isFullScreen) => console.log(isFullScreen)}
    />
  );
};

export default App;

Props

The OVContentViewer component accepts the following props:

PropTypeDescription
didstringThe decentralized identifier for the content.
size"sm" | "md" | "lg"The size of the content viewer. Default is "md".
titlestringThe title of the content viewer.
render(data: any) => React.ReactNodeCustom render function for the content.
renderProps{ title?: string; onClose: () => void; validatedAt: Date | null; }Props for the custom render function.
resourceTypesstring[]Array of resource types to be rendered.
resourceRenderer(resource: any) => React.ReactNodeCustom renderer for resources.
isFullScreenbooleanIndicates if the viewer is in full-screen mode.
setIsFullScreen(isFullScreen: boolean) => voidFunction to toggle full-screen mode.
isEmbeddedbooleanIndicates if the viewer is embedded.
isHoverablebooleanIndicates if hover effects are enabled.
hideOriginInfoIconbooleanHides the origin info icon if true.
srcstringThe source URL of the content to be displayed.
typestringThe MIME type of the content. Default is "image/png".
altstringAlternative text for the content.
isDarkModebooleanIndicates if dark mode is enabled.
embeddedBackgroundColorstringBackground color for embedded mode.
isMobilebooleanIndicates if the viewer is being used on a mobile device.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Acknowledgments

0.0.10-alpha.4

7 months ago

0.0.10-alpha.3

7 months ago

0.0.10-alpha.2

7 months ago

0.0.10-alpha.1

7 months ago

0.0.9

7 months ago

0.0.9-alpha.1

7 months ago

0.0.8

7 months ago

0.0.8-alpha.3

7 months ago

0.0.8-alpha.2

7 months ago

0.0.8-alpha.1

7 months ago

0.0.7

7 months ago

0.0.6

7 months ago

0.0.6-alpha.14

7 months ago

0.0.6-alpha.12

7 months ago

0.0.6-alpha.11

7 months ago

0.0.6-alpha.10

7 months ago

0.0.6-alpha.9

7 months ago

0.0.6-alpha.8

7 months ago

0.0.6-alpha.6

7 months ago

0.0.6-alpha.5

7 months ago

0.0.6-alpha.4

7 months ago

0.0.6-alpha.3

7 months ago

0.0.6-alpha.2

7 months ago

0.0.6-alpha.1

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.2-alpha.1

7 months ago

0.0.1

7 months ago

0.0.1-alpha.11

7 months ago

0.0.1-alpha.10

7 months ago

0.0.1-alpha.9

7 months ago

0.0.1-alpha.8

7 months ago

0.0.1-alpha.7

7 months ago

0.0.1-alpha.6

7 months ago

0.0.1-alpha.5

7 months ago

0.0.1-alpha.3

7 months ago

0.0.1-alpha.2

7 months ago

0.0.1-alpha.1

7 months ago

0.0.1-alpha

7 months ago