{"id":13808749,"url":"https://github.com/binance-academy/fallback-image","last_synced_at":"2025-05-14T03:31:30.795Z","repository":{"id":35120651,"uuid":"209244896","full_name":"binance-academy/fallback-image","owner":"binance-academy","description":"Display a fallback while an image is loading","archived":false,"fork":false,"pushed_at":"2023-01-06T02:09:28.000Z","size":3633,"stargazers_count":7,"open_issues_count":19,"forks_count":2,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2024-04-24T04:11:44.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@binance-academy/fallback-image","language":"JavaScript","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/binance-academy.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-09-18T07:23:56.000Z","updated_at":"2023-01-15T18:18:42.000Z","dependencies_parsed_at":"2023-01-15T14:15:44.439Z","dependency_job_id":null,"html_url":"https://github.com/binance-academy/fallback-image","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binance-academy%2Ffallback-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binance-academy%2Ffallback-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binance-academy%2Ffallback-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binance-academy%2Ffallback-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binance-academy","download_url":"https://codeload.github.com/binance-academy/fallback-image/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225273267,"owners_count":17448075,"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":[],"created_at":"2024-08-04T01:01:51.036Z","updated_at":"2024-11-19T00:31:04.463Z","avatar_url":"https://github.com/binance-academy.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# fallback-image\n\n[![Version](https://img.shields.io/npm/v/@binance-academy/fallback-image.svg?style=flat-square)](https://www.npmjs.com/package/@binance-academy/fallback-image)\n[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/binance-academy/fallback-image/Lint/master?style=flat-square)](https://github.com/binance-academy/fallback-image/actions?query=workflow%3ALint)\n[![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@binance-academy/fallback-image.svg?color=yellow\u0026style=flat-square)](https://bundlephobia.com/result?p=@binance-academy/fallback-image)\n[![Downloads](https://img.shields.io/npm/dm/@binance-academy/fallback-image.svg?color=green\u0026style=flat-square)](https://www.npmjs.com/package/@binance-academy/fallback-image)\n[![CodeStyle](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n\nDisplay a fallback while an image is loading, to avoid a jump effect when the image loads.\n\n[![example](example.gif)](https://academy.binance.com)\n\n## Install\n\n```shell\nnpm i @binance-academy/fallback-image\n# -or-\nyarn add @binance-academy/fallback-image\n```\n\n## Usage\n\n### Props\n\n`src`: Url of the image\n\n`alt`: Alternative text to displayed if the image connot be loaded\n\n`invertedRatio`: Inverted ratio as a % (**Default:** 9/16\\*100=56.25)\n\n### Example\n\n```javascript\nimport Image from \"fallback-image\";\n\n...\n\n\u003cImage alt=\"Alt text\" src=\"https://via.placeholder.com/800x450\" /\u003e\n\n\u003cImage\n    alt=\"Alt text\"\n    src=\"https://via.placeholder.com/400x300\"\n    invertedRatio={(3 / 4) * 100}\n/\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinance-academy%2Ffallback-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinance-academy%2Ffallback-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinance-academy%2Ffallback-image/lists"}