{"id":22833173,"url":"https://github.com/brunobertolini/styled-by","last_synced_at":"2025-09-07T01:36:30.032Z","repository":{"id":23439004,"uuid":"99022390","full_name":"brunobertolini/styled-by","owner":"brunobertolini","description":"Simple and powerful lib to handle styled props in your components","archived":false,"fork":false,"pushed_at":"2022-06-19T19:23:07.000Z","size":132,"stargazers_count":136,"open_issues_count":1,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-14T21:25:30.644Z","etag":null,"topics":["css","css-in-js","hacktoberfest","props","react","react-native","styled-components","styles"],"latest_commit_sha":null,"homepage":"https://codesandbox.io/s/ElvL8EKgg","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/brunobertolini.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"brunobertolini"}},"created_at":"2017-08-01T16:35:48.000Z","updated_at":"2025-06-06T07:58:38.000Z","dependencies_parsed_at":"2022-08-30T00:12:07.169Z","dependency_job_id":null,"html_url":"https://github.com/brunobertolini/styled-by","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/brunobertolini/styled-by","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunobertolini%2Fstyled-by","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunobertolini%2Fstyled-by/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunobertolini%2Fstyled-by/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunobertolini%2Fstyled-by/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brunobertolini","download_url":"https://codeload.github.com/brunobertolini/styled-by/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunobertolini%2Fstyled-by/sbom","scorecard":{"id":255260,"data":{"date":"2025-08-11","repo":{"name":"github.com/brunobertolini/styled-by","commit":"e481d41325fb07e85fa7d95f7db14109b36bbf79"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"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":"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":"Code-Review","score":0,"reason":"Found 0/27 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":"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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":"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":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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"}}]},"last_synced_at":"2025-08-17T09:32:43.378Z","repository_id":23439004,"created_at":"2025-08-17T09:32:43.378Z","updated_at":"2025-08-17T09:32:43.378Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273986611,"owners_count":25202704,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"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":["css","css-in-js","hacktoberfest","props","react","react-native","styled-components","styles"],"created_at":"2024-12-12T21:12:25.266Z","updated_at":"2025-09-07T01:36:30.004Z","avatar_url":"https://github.com/brunobertolini.png","language":"JavaScript","funding_links":["https://github.com/sponsors/brunobertolini"],"categories":["JavaScript","CSS-in-JS"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"logo.png\" alt=\"StyledBy\" /\u003e\n\u003c/h1\u003e\n\n[![Build Status](https://travis-ci.org/brunobertolini/styled-by.svg?branch=master)](https://travis-ci.org/brunobertolini/styled-by) [![codecov](https://codecov.io/gh/brunobertolini/styled-by/badge.svg?branch=master)](https://codecov.io/gh/brunobertolini/styled-by?branch=master)\n\n\u003e Simple and powerful lib to handle styled props in your components\n\n## Install\n\n```\nyarn add styled-by\n```\n\n## Basic usage\n\n```js\nimport React from 'react';\nimport styled from 'styled-components';\nimport styledBy from 'styled-by';\n\nconst Button = styled.button`\n  background: ${styledBy('background')};\n  color: ${styledBy('color')};\n  padding: 10px;\n  border-radius: 10px;\n`;\n\nexport default function App() {\n  return (\n    \u003cButton background=\"#FFF\" color=\"rgba(0,0,0,0.5)\"\u003e\n      Ok\n    \u003c/Button\u003e\n  );\n}\n```\n\n## Options\n\nBasicaly, if you use `styledBy('prop')`, it returns prop value. But, if you want do more, use options.\n\nOptions can be:\n- string;\n- function;\n- object (and object value can be string or function)\n\n### String\n\nOption as string, will be applied when prop is present.\n\n```js\nconst Button = styled.button`\n  ${styledBy('disabled', 'background: #CCC;')}\n`\n\n\u003cButton disabled /\u003e\n```\n\n### Function\n\nOption as function, always will be called passing props, even if props is undefined\n\n```js\n  const Button = styled.button`\n  ${styledBy('disabled', props =\u003e `background: ${props.disabled ? '#CCC' : '#FFF'};`)}\n`\n\n\u003cButton disabled /\u003e\n```\n\n### Object String\n\nOption as object string, will be handled by prop value\n\n```js\nconst Button = styled.button`\n  ${styledBy('corner', {\n    rounded: `border-radius: 5px;`,\n    circle: `border-radius: 100px;`\n  })}\n`\n\n\u003cButton corner=\"rounded\" /\u003e\n```\n\nWhen option is a object, and styledBy don't find passed option, and if `_` option is defined as a function, call it.\n\n```js\nconst Button = styled.button`\n  ${styledBy('corner', {\n    _: ({ corner }) =\u003e {}\n    rounded: `border-radius: 5px;`,\n    circle: `border-radius: 100px;`\n  })}\n`\n\n\u003cButton corner=\"square\" /\u003e\n```\n\n### Object Function\n\nOption as object function, will be handled by prop value, and call function as prop param\n\n```js\nconst Button = styled.button`\n  ${styledBy('kind', {\n    default: ({ theme, color }) =\u003e `\n      background: ${theme.colors[color].base};\n      color: ${theme.colors[color].contrast};\n      border: none;\n    `,\n    outline: ({ theme, color }) =\u003e `\n      background: transparent;\n      color: ${theme.colors[color].base};\n      border: 1px solid ${theme.colors[color].base};\n    `,\n    clean: ({ theme, color }) =\u003e `\n      background: transparent;\n      color: ${theme.colors[color].base};\n      border: none;\n    `\n  })}\n`\n\n\u003cButton color=\"primary\" kind=\"outline\" /\u003e\n```\n\n### Options list\n\nInstead of prop name in firts param, you can pass many options as a object\n\n```js\nconst Button = styled.button`\n  ${styledBy({\n    disabled: `background: #CCC;`,\n    corner: {\n      square: 'border-radius: 0;',\n      rounded: 'border-radius: 5px;',\n      circle: 'border-radius: 50px;'\n    }\n  })}\n`\n```\n\nThis works like many styledBy props declarations\n\n## License\n\nMIT © [Bruno Bertolini](http://brunobertolini.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunobertolini%2Fstyled-by","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrunobertolini%2Fstyled-by","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunobertolini%2Fstyled-by/lists"}