{"id":21554641,"url":"https://github.com/jwo/react-hover-image","last_synced_at":"2025-04-10T09:26:25.540Z","repository":{"id":26181736,"uuid":"107593300","full_name":"jwo/react-hover-image","owner":"jwo","description":"A React Component for an image, which changes its source when mouse hovered.","archived":false,"fork":false,"pushed_at":"2022-12-13T10:22:49.000Z","size":3363,"stargazers_count":13,"open_issues_count":20,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T17:48:10.688Z","etag":null,"topics":["reactjs-components"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jwo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-19T20:09:38.000Z","updated_at":"2023-01-24T14:07:12.000Z","dependencies_parsed_at":"2022-09-11T18:02:05.250Z","dependency_job_id":null,"html_url":"https://github.com/jwo/react-hover-image","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwo%2Freact-hover-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwo%2Freact-hover-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwo%2Freact-hover-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwo%2Freact-hover-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwo","download_url":"https://codeload.github.com/jwo/react-hover-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248190779,"owners_count":21062342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["reactjs-components"],"created_at":"2024-11-24T07:15:38.275Z","updated_at":"2025-04-10T09:26:25.514Z","avatar_url":"https://github.com/jwo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Hover Image\n\n![travis-status](https://img.shields.io/travis/jwo/react-hover-image.svg)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d749dc7ef0b1d094deb2/maintainability)](https://codeclimate.com/github/jwo/react-hover-image/maintainability)\n[![Coverage Status](https://coveralls.io/repos/github/jwo/react-hover-image/badge.svg?branch=master)](https://coveralls.io/github/jwo/react-hover-image?branch=master)\n\n## Description\n\nA React Component for an image, which changes its source when mouse hovered.\n\n## Usage\n\n1. Add to your React project:\n\n`yarn add react-hover-image`\n\n2. Import and use\n\n```js\nimport React from \"react\";\nimport HoverImage from \"react-hover-image\";\nimport yourFile from \"./images/yourFile.svg\";\nimport yourFileHover from \"./images/yourFile-hover.svg\";\n\nconst YourComponent: React.SFC = () =\u003e {\n  return (\n    \u003cdiv\u003e\n      \u003ch2\u003eOh Hai!\u003c/h2\u003e\n      \u003cHoverImage src={yourFile} hoverSrc={yourFileHover} /\u003e\n    \u003c/div\u003e\n  );\n};\n```\n\n### Props\n\n`src` and `hoverSrc` are the only required props.\n\n- **src** : Default image source\n- **hoverSrc** : On hover, show this\n- **onClick** : function to invoke when the image is clicked\n- **disabled** : You can disable clicks\n- **style** : Style props to pass to the `img`\n- **className** : CSS class name to pass to the `img`\n\n```ts\nexport type HoverImageProps = {\n  src: string;\n  hoverSrc: string;\n  disabled?: boolean;\n  className?: string;\n  style?: any;\n  onClick?: React.MouseEventHandler;\n};\n```\n\n### Typescript\n\nWe publish types at `index.d.ts` with version 2.0.\n\n### Demos\n\nYou can view a running storybook at http://jessewolgamott.com/react-hover-image/ or you can download and run `yarn storybook`\n\n### Tips:\n\n- If using webpack, use `image-loader` to load your images into a data-url and\n  get semi-instant response times on your hover\n\n### Why should I use this?\n\nI was working on a project where client wanted to use graphic buttons for\ninstead of CSS buttons. This is extracted from that project.\n\n## LICENSE\n\nThe MIT License\n\nCopyright 2017 Jesse Wolgamott\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwo%2Freact-hover-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwo%2Freact-hover-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwo%2Freact-hover-image/lists"}