ShortLink.tsx 350 B

1234567891011121314151617
  1. import css from "./ShortLink.module.scss";
  2. export interface ShortLinkProps {
  3. url: string;
  4. }
  5. export const ShortLink = ({ url }: ShortLinkProps) => {
  6. return (
  7. <div className={css.shortlink}>
  8. <a href={url}>{stripScheme(url)}</a>
  9. </div>
  10. );
  11. };
  12. function stripScheme(url: string): string {
  13. return url.replace(/^https?:\/\//, "");
  14. }