fbredius/storybook

View on GitHub
addons/docs/src/blocks/Anchor.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import React, { FC } from 'react';

export const anchorBlockIdFromId = (storyId: string) => `anchor--${storyId}`;

export interface AnchorProps {
  storyId: string;
}

export const Anchor: FC<AnchorProps> = ({ storyId, children }) => (
  <div id={anchorBlockIdFromId(storyId)}>{children}</div>
);