{"id":17236607,"url":"https://github.com/illright/react-feed","last_synced_at":"2025-03-26T01:42:06.392Z","repository":{"id":178177957,"uuid":"661454221","full_name":"illright/react-feed","owner":"illright","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-03T20:03:23.000Z","size":58,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-30T23:14:45.757Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/illright.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-02T22:28:00.000Z","updated_at":"2023-07-02T22:28:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"ad570415-7483-4c51-8fa8-6123603fd6ca","html_url":"https://github.com/illright/react-feed","commit_stats":null,"previous_names":["illright/react-feed"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/illright%2Freact-feed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/illright%2Freact-feed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/illright%2Freact-feed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/illright%2Freact-feed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/illright","download_url":"https://codeload.github.com/illright/react-feed/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245573840,"owners_count":20637670,"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-10-15T05:36:33.079Z","updated_at":"2025-03-26T01:42:06.373Z","avatar_url":"https://github.com/illright.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @illright/react-feed\n\n![npm version](https://img.shields.io/npm/v/@illright/react-feed)\n![minzipped package size](https://img.shields.io/bundlephobia/minzip/@illright/react-feed.svg)\n\n_Your list of cards could do with a bit of keyboard navigation, eh?_\n\nThe headless implementation of the [ARIA feed pattern](https://www.w3.org/WAI/ARIA/apg/patterns/feed/) for React.\n\n## Installation\n\n```bash\npnpm add @illright/react-feed\n```\n\nType definitions are built in 😎. \n\nMinimum requirements for React? The one that has hooks (16.8+), that's it.\n\n\u003cdetails\u003e\n  \u003csummary\u003eI don't use \u003ccode\u003epnpm\u003c/code\u003e\u003c/summary\u003e\n\nWhat do you mean \"I don't use [`pnpm`](https://pnpm.io)\"? It's so much faster! Alright, here's your `npm` command:\n\n```bash\nnpm install --save @illright/react-feed\n```\n\n\u003c/details\u003e\n\n## Usage\n\nIt exports two components: \n* `Feed`, the list of cards  \n  Props:\n  * `aria-labelledby?: string`, the ID of the element that labels the feed. This element should be outside the feed, like a sibling.\n  * `aria-busy?: boolean`, whether the feed is being updated with more articles.\n* `Article`, each individual card  \n  Props:\n  * **Required**: `aria-labelledby: string`, the ID of the element that labels the article. This element should be inside the article.\n  * `aria-describedby?: string`, the ID of the element that describes the article. It should be inside the article.\n\nHere's an example (see the [demo](./demo) folder for a complete one): \n\n```tsx\nimport { useId } from \"react\";  // This is from React 18, but you don't have to use it\nimport { Feed, Article } from \"react-feed\";\n\n// ↓ This is a hook to fetch data, e.g. from React Query\nimport { useArticles } from \"./data\";\n\nexport function App() {\n  const idBase = useId();\n  const { data: articles, fetchNextPage, isFetching } = useArticles();\n\n  return (\n    \u003cFeed aria-busy={isFetching}\u003e\n      {articles.map((article) =\u003e (\n        \u003cArticle\n          key={article.title}\n          aria-labelledby={`${idBase}-${article.id}`}\n          aria-describedby={`${idBase}-${article.id}-desc`}\n        \u003e\n          \u003ch2 id={`${idBase}-${article.id}`}\u003e{article.title}\u003c/h2\u003e\n          \u003cp id={`${idBase}-${article.id}-desc`}\u003e\n            {article.description}\n          \u003c/p\u003e\n        \u003c/Article\u003e\n      ))}\n      // ↓ Note that the \"load more\" button should be an article too.\n      \u003cArticle aria-labelledby={`${idBase}-more`}\u003e\n        \u003cbutton\n          id={`${idBase}-more`}\n          onClick={() =\u003e fetchNextPage()}\n        \u003e\n          Load more posts\n        \u003c/button\u003e\n      \u003c/Article\u003e\n    \u003c/Feed\u003e\n  );\n}\n```\n\n### Styling\n\nThe `\u003cFeed\u003e` component renders a `\u003cdiv role=\"feed\"\u003e` with no styling, you can pass any other props to it, for example, a class to style it. Similarly, the `\u003cArticle\u003e` renders a `\u003carticle\u003e` with no styling.\n\nTherefore, styling with Tailwind CSS, plain CSS, or any other CSS-in-JS library is easy. Styling with styled-components will be supported in future versions.\n\n## License\n\nThe source code of this project is distributed under the terms of the ISC license. It's like MIT, but better. [Click here](https://choosealicense.com/licenses/isc/) to learn what that means.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fillright%2Freact-feed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fillright%2Freact-feed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fillright%2Freact-feed/lists"}