# @acctglobal/image-gallery

Latest version **0.4.3** (published 2022-07-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @acctglobal/image-gallery
pnpm add @acctglobal/image-gallery
yarn add @acctglobal/image-gallery
bun add @acctglobal/image-gallery
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.3 |
| Published | 2022-07-19 |
| First published | 2022-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 103.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Raphael Marinho |
| Maintainers | luiz.priolli, ricardo.freitas, fabioacct |

## Links

- npm: https://www.npmjs.com/package/@acctglobal/image-gallery
- npm.io page: https://npm.io/package/@acctglobal/image-gallery

## Recent versions

- 0.4.3 (latest) — 2022-07-19
- 0.3.3 — 2022-07-11
- 0.3.2 — 2022-07-08
- 0.3.1 — 2022-07-08
- 0.3.0 — 2022-07-07
- 0.2.0 — 2022-07-05
- 0.1.7 — 2022-07-05
- 0.1.6 — 2022-07-05
- 0.1.5 — 2022-07-04
- 0.1.4 — 2022-07-04
- 0.1.3 — 2022-07-04
- 0.1.2 — 2022-07-04
- 0.1.1 — 2022-07-01

## README

# Image Gallery

<br/>

## Getting Started

This component can be used anywhere you want in e-commerce, in a responsive and agnostic way. You just need to have React on
your project.

<br>
How the component looks like:

</br>

### On desktop

![image](https://user-images.githubusercontent.com/92031730/176493251-8699c653-295f-4c94-a361-6c4724b2292f.png)

</br>

### On mobile

_obs: You can ignore the mobile layout. Just don't use the `isMobile` property._

![image](https://user-images.githubusercontent.com/92031730/176493929-ffa5a648-1374-4e8f-a6a5-652b1cd8cb69.png)

</br>

## Installation and usage

To use Image Gallery, you need to install the package via yarn or npm and import it wherever you want to use it.

```bash
yarn add @acctglobal/image-gallery
// or npm install
```

</br>

Now you just need to import and use the component.

```javascript
import ImageGallery from '@acctglobal/image-gallery';
```

```jsx
<ImageGallery
  images={images}
  defaultMainImageSizes={{ width: [200, 500], height: [200, 500] }}
  imageSelectorSizes={{ height: [30, 60], width: [30, 60] }}
/>
```

</br>

### Styling

On your css file:

```css
[data-sf-gallery-container] {
  ...yourStyles;
}
```

#### All attributes

`data-sf-gallery-container` <br>
`data-sf-gallery-selector-container` <br>
`data-sf-gallery-selector-images-container` <br>
`data-sf-gallery-selector-button` <br>
`data-sf-gallery-selector-image` <br>
`data-sf-gallery-selector-image="selected"` <br>
`data-sf-selector-arrow` <br>
`data-sf-selector-arrow-backward` <br>
`data-sf-selector-arrow-forward`<br>
`data-sf-gallery-main-image-container` <br>
`data-sf-gallery-main-image`<br>

</br>

### Props

| Parameter              | Type                            | Description                                                                                                                                        |
| :--------------------- | :------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------- |
| `images`               | `Image[]`                       | **Mandatory**. Array of images to mount gallery. First image will be the main image.                                                               |
| `imageSelectorSizes`   | `Size`                          | **Mandatory**. Object containing size of selector images.                                                                                          |     |
| `defaultMainImageSize` | `Size`                          | **Mandatory**. Object containing size of main image.                                                                                               |
| `isMobile`             | `boolean`                       | **Optional**. Boolean that indicates if device size is mobile or not.                                                                              |
| `CustomImageComponent` | `ComponentType<ImageComponent>` | **Optional**. Custom image component to used on main image. Need to be typed as `Image`. Can contain other optional properties.                    |
| `ArrowIcon`            | `ReactNode`                     | **Optional**. Custom arrow component for image selector. Component have a default arrow. If you prefer to use an custom arrow, choose an up arrow. |
| `showArrow`            | `boolean`                       | **Optional**. boolean that indicates if show arrow button horizontal.

<br>

## Types

<br>

### Size

| Property | Type                      | Description   |
| -------- | ------------------------- | ------------- |
| `width`  | `number[mobile, desktop]` | **Mandatory** |
| `height` | `number[mobile, desktop]` | **Mandatory** |

<br>

### Image

| Property        | Type     | Description   |
| --------------- | -------- | ------------- |
| `url`           | `string` | **Mandatory** |
| `alternateName` | `string` | **Mandatory** |

</br>

### ImageComponent

_obs: acceps any other opitional properties._

| Property        | Type     | Description   |
| --------------- | -------- | ------------- |
| `src`           | `string` | **Mandatory** |
| `alt`           | `string` | **Mandatory** |
| `width`         | `number` | **Mandatory** |
| `height`        | `number` | **Mandatory** |
| `...otherProps` | `any`    | **Optional**  |

</br> </br>

<!-- CONTRIBUTING -->

## Contributing

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
6. And don't forget to update the changelog

</br>

<!-- CONTACT -->

## Contact

Raphael Marinho - raphael.marinho@acct.global

---
_Source: https://npm.io/package/@acctglobal/image-gallery · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
