# mtg-card-viewer

> React Component to allow for quick lookup of Magic: the Gathering cards for React Applications.

Latest version **0.1.5** (published 2019-03-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install mtg-card-viewer
pnpm add mtg-card-viewer
yarn add mtg-card-viewer
bun add mtg-card-viewer
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2019-03-18 |
| First published | 2019-03-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 37.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Maintainers | tutch |
| Keywords | magic the gathering, mtg, react, component |

## Links

- npm: https://www.npmjs.com/package/mtg-card-viewer
- Repository: https://github.com/Tutch/MtgCardViewer
- Homepage: https://github.com/Tutch/MtgCardViewer#readme
- Issues: https://github.com/Tutch/MtgCardViewer/issues
- npm.io page: https://npm.io/package/mtg-card-viewer

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.5 (latest) — 2019-03-18
- 0.1.4 — 2019-03-13
- 0.1.3 — 2019-03-13
- 0.1.2 — 2019-03-13
- 0.1.1 — 2019-03-13
- 0.1.0 — 2019-03-13

## README

# MtgCardViewer
## What's this?
MtgCardViewer mimics the link functionality of channel fireball, mtggoldfish and the mtg wiki for react apps. You can pass a *searchTerm* as prop to the component and it will look for this card on [Scryfall](https://scryfall.com). Upon hovering on the card name (or clicking if on *mobileMode*) the image will appear right below the card name. 

## Installation
```console
npm i mtg-card-viewer -s
```

## Usage and Options

The most basic usage is simply passing the searchTerm as a prop to the card component:

```javascript
import React from 'react';
import ReactDOM from 'react-dom';
import { MtgCardViewer } from 'mtg-card-viewer';

class App extends React.Component {
  render() {
    return (
      <div className="App">
        <p>Of all MTG cards, <MtgCardViewer searchTerm='lightning bolt'/> is my favorite!</p>
      </div>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('app'));
```

MtgCardViewer looks for the **exact** *searchTerm* as it uses Scryfall !"" search option. The terms don't have to be case sensitive and some incomplete names will be returned. For example, searching for "elspeth knight errant" will correctly return [Elspeth, Knight Errant](https://scryfall.com/card/md1/13/elspeth-knight-errant).

The component accepts some other optional properties:

- **imageClass**: by default the card box uses the .mtgCardViewerBox class. If you don't want to rewrite it you can provide your own class using this prop.
- **imageStyling**: inline stylings to pass to the card box if you want to change a single property, like the padding or giving the card box a border.
- **mobileMode**: by default it's false. mobileMode set as true will change the behavior of the component. Instead of showing the image on hover it will only show on a click. Clicking anywhere outside the component will hide the image again.
- **imageWidth**: by default the image width is 280 pixels. You can provide another width here. Please note that this options does not work if you use the imageStyling, but of course you can just give it a width using imageStyling.

---
_Source: https://npm.io/package/mtg-card-viewer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
