Skip to content

Commit

Permalink
docs: add a new decorator for storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
jtiala committed Apr 17, 2024
1 parent 256595f commit 1fd2b7d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions apps/docs/utils/decorators.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
import { Decorator } from "@storybook/react";
import { useEffect, useState } from "react";

export const hiddenLabelDecorator: (htmlFor: string) => Decorator = (
htmlFor,
) => {
const decorator: Decorator = (Story) => (
<>
<label
htmlFor={htmlFor}
style={{
position: "absolute",
overflow: "hidden",
width: "1px",
height: "1px",
padding: 0,
borderWidth: 0,
margin: "-1px",
clip: "rect(0, 0, 0, 0)",
whiteSpace: "nowrap",
}}
>
{htmlFor}
</label>
<Story />
</>
);

return decorator;
};

export const marginDecorator: (
margin:
| {
Expand Down

0 comments on commit 1fd2b7d

Please sign in to comment.