{"id":24377640,"url":"https://github.com/enescang/react-preview-link","last_synced_at":"2025-07-23T02:04:31.647Z","repository":{"id":188803928,"uuid":"675985786","full_name":"enescang/react-preview-link","owner":"enescang","description":"React Preview Link","archived":false,"fork":false,"pushed_at":"2023-08-16T21:43:13.000Z","size":284,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-01T03:05:11.400Z","etag":null,"topics":["link-preview","preview-links"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-preview-link","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/enescang.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,"governance":null}},"created_at":"2023-08-08T07:13:19.000Z","updated_at":"2023-08-16T21:45:36.000Z","dependencies_parsed_at":"2023-08-16T23:50:41.590Z","dependency_job_id":null,"html_url":"https://github.com/enescang/react-preview-link","commit_stats":null,"previous_names":["enescang/react-preview-link"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/enescang/react-preview-link","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enescang%2Freact-preview-link","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enescang%2Freact-preview-link/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enescang%2Freact-preview-link/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enescang%2Freact-preview-link/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enescang","download_url":"https://codeload.github.com/enescang/react-preview-link/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enescang%2Freact-preview-link/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266604009,"owners_count":23954725,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["link-preview","preview-links"],"created_at":"2025-01-19T06:16:31.240Z","updated_at":"2025-07-23T02:04:31.603Z","avatar_url":"https://github.com/enescang.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Preview Link\n\n\nA flexible React component that helps you display preview links with customizable styles.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Props](#props)\n- [Changelog](#changelog)\n- [Todo](#todo)\n- [License](#license)\n\n## Installation\n\nYou can install `react-preview-link` using npm:\n\n```bash\nnpm install react-preview-link\n```\n\nor using yarn:\n\n```bash\nyarn add react-preview-link\n```\n\n## Usage\n\nTo use the `PreviewLink` component, import it into your React component and pass the props.\n\n### Basic Example With Default Props\n```jsx\nimport React from 'react';\nimport PreviewLink from 'react-preview-link';\n\nconst MyComponent = () =\u003e {\n  return (\n    \u003cPreviewLink\n      url=\"https://github.com\"\n    /\u003e\n  );\n};\n```\n### Fully Customized Example\n```jsx\nimport React from 'react';\nimport PreviewLink from 'react-preview-link';\n\nconst MyComponent = () =\u003e {\n  return (\n    \u003cPreviewLink\n      url=\"https://github.com\"\n      width={300}\n      height={200}\n      margin={10}\n      border=\"1px solid #ccc\"\n      direction=\"horizontal\"\n      reverse={false}\n      imageCoverage={70}\n      content={{\n        vertical: 'center',\n        horizontal: 'start',\n        margin: 5,\n        gap: 5,\n      }}\n      image={{\n        borderRadius: 8,\n        margin: 5,\n      }}\n    /\u003e\n  );\n};\n\nexport default MyComponent;\n```\n\n## Props\n\nThe `PreviewLink` component accepts the following props:\n\n```js\ntype PreviewLinkProps = {\n  url: string,\n  width: number,\n  height: number,\n  margin: number,\n  border: string,\n  direction: Direction,\n  reverse: boolean,\n  imageCoverage: number,\n  content: {\n    vertical?: AlignmentDirection,\n    horizontal?: AlignmentDirection,\n    margin?: number | string,\n    gap?: number,\n  },\n  image: {\n    borderRadius?: number | string,\n    margin?: number | string,\n  },\n};\n```\n\n### Props Table\n\n| Prop            | Type                                          | Description                                                  |\n|-----------------|-----------------------------------------------|--------------------------------------------------------------|\n| `url`           | `string`                                      | The URL of the preview link.                                 |\n| `width`         | `number`                                      | The width of the preview container.                          |\n| `height`        | `number`                                      | The height of the preview container.                         |\n| `margin`        | `number`                                      | The margin around the preview container.                     |\n| `border`        | `string`                                      | The border style of the preview container.                   |\n| `direction`     | `'horizontal'` or `'vertical'`                | The direction of content alignment.                          |\n| `reverse`       | `boolean`                                     | Whether to reverse the content and image positions.          |\n| `imageCoverage` | `number` (0 to 100)                             | The coverage percentage of the image on the preview.         |\n| `content`       | `{ vertical?, horizontal?, margin?, gap? }` | Object containing content alignment and spacing settings.   |\n| `image`         | `{ borderRadius?, margin? }`                | Object containing image styling settings.                    |\n\nIt is not on the table but adding the\u003ccode\u003ekey\u003c/code\u003e prop is highly recommended. It is important especially if you have multiple PreviewLink. More information about key prop: https://react.dev/learn/rendering-lists#rules-of-keys\n\n## Changelog\n### Version 1.0.1 (17.08.2023)\n- Initial production release\n- Added 4 layout option to preview link\n- Seperated style option for image and content\n\n\n## Todo\nHere are some ideas and planned features for future releases of `react-preview-link`:\n\n- [ ] **Demo**: Add demo images and create a showcase\n- [ ] **Examples**: Create examples folder to provide different layout examples.\n- [ ]  **Enhanced Styling**: Provide more built-in styles for the preview link. Primary and secondary color\n- [ ] **Content Manipulation**: Handle link title and link description with callback. (For example: get substring of description)\n- [ ] **Caching**: Cache the requested links for a while to decrease latency.\n- [ ] **Image Lazy Loading Animation**: Add a simple lazy loading system for image. (Maybe with: https://loading.io/css/)\n\n## License\nThis project is licensed under the [MIT License](LICENSE).\n\n## Thanks\n- ChatGPT: (for helping me create this file)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenescang%2Freact-preview-link","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenescang%2Freact-preview-link","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenescang%2Freact-preview-link/lists"}