{"id":49453737,"url":"https://github.com/mapbox/appropriate-images-react","last_synced_at":"2026-06-18T22:01:02.824Z","repository":{"id":22108022,"uuid":"95326386","full_name":"mapbox/appropriate-images-react","owner":"mapbox","description":"Given an appropriate-images configuration, render the appropriate size variant of an image","archived":true,"fork":false,"pushed_at":"2024-04-12T18:03:47.000Z","size":2964,"stargazers_count":13,"open_issues_count":0,"forks_count":4,"subscribers_count":104,"default_branch":"main","last_synced_at":"2025-04-21T08:56:49.485Z","etag":null,"topics":["docs-infrastructure"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapbox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-06-24T22:38:00.000Z","updated_at":"2024-04-12T18:04:08.000Z","dependencies_parsed_at":"2023-11-02T17:25:24.445Z","dependency_job_id":null,"html_url":"https://github.com/mapbox/appropriate-images-react","commit_stats":{"total_commits":35,"total_committers":5,"mean_commits":7.0,"dds":0.6857142857142857,"last_synced_commit":"0ccbcb3050943294e1261012a6003c05e6553a5f"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/mapbox/appropriate-images-react","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fappropriate-images-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fappropriate-images-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fappropriate-images-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fappropriate-images-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/appropriate-images-react/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fappropriate-images-react/sbom","scorecard":{"id":616373,"data":{"date":"2025-08-11","repo":{"name":"github.com/mapbox/appropriate-images-react","commit":"17ee8d3e0923aa7e99268e3087f35ef73fad623a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 1/15 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":5,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Info: 'force pushes' disabled on branch 'main'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'main'","Warn: 'stale review dismissal' is disabled on branch 'main'","Warn: required approving review count is 1 on branch 'main'","Warn: codeowners review is not required on branch 'main'","Warn: 'last push approval' is disabled on branch 'main'","Warn: no status checks found to merge onto branch 'main'","Info: PRs are required in order to make changes on branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/mapbox/.github/SECURITY.md:1","Info: Found linked content: github.com/mapbox/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/mapbox/.github/SECURITY.md:1","Info: Found text in security policy: github.com/mapbox/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T04:07:04.185Z","repository_id":22108022,"created_at":"2025-08-21T04:07:04.185Z","updated_at":"2025-08-21T04:07:04.185Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34508867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["docs-infrastructure"],"created_at":"2026-04-30T04:01:03.704Z","updated_at":"2026-06-18T22:01:02.819Z","avatar_url":"https://github.com/mapbox.png","language":"JavaScript","funding_links":[],"categories":["📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"readme":"# @mapbox/appropriate-images-react\n\n## Note: As of April 2024 this repository is no longer used or maintained.\n\n[![Build Status](https://travis-ci.com/mapbox/appropriate-images-react.svg?branch=main)](https://travis-ci.com/mapbox/appropriate-images-react)\n\n**Use in combination with [appropriate-images].**\n\nAfter you've generated resized, optimized images with [appropriate-images], you'll want to use them in the browser.\nIf you like React, you'll want to use them with React.\nYou'll need to determine *which variant* of the image to load — that is, which size, and whether to load the `.webp` version or not.\nThis module does that.\n\nHere are the steps it takes.\n\n- Measures the element's available width with [react-simple-surveyor](https://github.com/mapbox/react-simple-surveyor);\n- Combines that width with your [appropriate-images configuration] to get a URL, using [appropriate-images-get-url];\n- Then renders the appropriate variant of the image.\n\n(If you aren't using React but want to use your [appropriate-images] in the browser, check out [appropriate-images-get-url](https://github.com/mapbox/appropriate-images-get-url)).\n\n## API\n\n### scopeAppropriateImage\n\n`scopeAppropriateImage(imageConfig, [options])`\n\nA named import for ES2015 modules, or a property on the CommonJS module.\n\n```js\nimport { scopeAppropriateImage } from '@mapbox/appropriate-images-react';\n// OR\nconst scopeAppropriateImage = require('@mapbox/appropriate-images-react').scopeAppropriateImage;\n```\n\nReturns an [AppropriateImage component](#appropriateimage) scoped according to your [appropriate-images configuration] and options.\n\n#### imageConfig\n\nType `Object`.\n**Required**.\n\nYour [appropriate-images configuration].\n**Use the same configuration at run time, in the browser, as you do at build time, when generating the resized, optimized images.**\n\n#### options\n\n##### transformUrl\n\nType: `(originalUrl: string) =\u003e string`.\nDefault: `x =\u003e x`.\n\nIf you want to transform the URL in some way, use this function.\nOne use-case is to take advantage of Webpack's augmented `require()` to get the URL *that Webpack creates* — if, for example, you're adding a hash to the end of files loaded with [Webpack's file-loader](https://github.com/webpack-contrib/file-loader).\n\nFor example:\n\n```js\nimport { scopeAppropriateImage } from '@mapbox/appropriate-images-react';\nconst AppropriateImage = scopeAppropriateImage(myImageConfig, {\n  transformUrl: url =\u003e require(`/my/image/directory/${url}`)\n});\n```\n\n##### hiResRatio\n\nType: `number`.\nDefault: `1.3`.\n\nSee [the same option for appropriate-images-get-url](https://github.com/mapbox/appropriate-images-get-url#hiresratio).\n\n### AppropriateImage\n\nThis is the component that is returned by [`scopeAppropriateImage`].\nIt can render your image in two ways:\n\n- As an `\u003cimg\u003e`.\n  Usually you'll do this.\n- As the background image of an absolutely positioned `\u003cdiv\u003e`.\n  This can be handy in situations when you want to take advantage of powerful CSS background properties like `background-size` and `background-position`.\n\n#### props\n\nAll props you pass other than those documented below are applied directly to the rendered element (e.g. `alt`, `id`, `data-*`, `aria-*`).\n\n##### imageId\n\nType `string`.\n**Required**.\n\nThe id of the image to render.\nMust correspond with a key in the [appropriate-images configuration].\n\n##### background\n\nType `boolean`.\nDefault: `false`.\n\nBy default, an `\u003cimg\u003e` element is rendered.\nIf this option is `true`, you instead get a `\u003cdiv\u003e`, absolutely positioned to fill its container, whose `background-image` will be the appropriate image.\n\n##### backgroundPosition\n\nType `string`.\nDefault: `'center center'`.\n\n**Only meaningful if `background={true}`.**\nAny `background-position` value will do.\n\n##### backgroundSize\n\nType `string`.\nDefault: `'cover'`.\n\n**Only meaningful if `background={true}`.**\nAny `background-size` value will do.\n\n## Example\n\n```js\nconst React = require('react');\nconst { scopeAppropriateImage } = require('@mapbox/appropriate-images-react');\nconst imageConfig = require('./path/to/my/image-config.js');\n\nconst AppropriateImage = scopeAppropriateImage(imageConfig);\n\nclass MyPage extends React.PureComponent {\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003cp\u003eAn appropriate image will be loaded below:\u003c/p\u003e\n        \u003cAppropriateImage imageId=\"bear\" style={{ maxWidth: '100%' }}/\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\n[appropriate-images]: https://github.com/mapbox/appropriate-images\n[appropriate-images configuration]: https://github.com/mapbox/appropriate-images#image-configuration\n[appropriate-images-get-url]: https://github.com/mapbox/appropriate-images-get-url\n[`scopeAppropriateImage`]: #scopeappropriateimage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fappropriate-images-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2Fappropriate-images-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fappropriate-images-react/lists"}