Skip to content

Commit a98356a

Browse files
committed
scaffold rotating cube
1 parent b425a28 commit a98356a

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed

packages/shared/src/client/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
// client component exports
10+
export * from "./rotating-cube";
1011
export * from "./demo";
1112
export * from "./header";
1213
export * from "./global-loader";
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"use client";
2+
3+
// component exports
4+
export * from "./rotating-cube";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.rotating-cube {
2+
/* create your container styles here */
3+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { cleanup, render, screen } from "@testing-library/react";
2+
import { afterEach, describe, test } from "vitest";
3+
import { RotatingCube } from "./rotating-cube";
4+
5+
describe.concurrent("rotating-cube", () => {
6+
afterEach(cleanup);
7+
8+
test("Dummy test - test if renders without errors", ({ expect }) => {
9+
const clx = "my-class";
10+
render(<RotatingCube className={clx} />);
11+
expect(screen.getByTestId("rotating-cube").classList).toContain(clx);
12+
});
13+
});
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { HTMLProps, ReactNode } from "react";
2+
import styles from "./rotating-cube.module.scss";
3+
4+
export interface RotatingCubeProps extends HTMLProps<HTMLDivElement> {
5+
children?: ReactNode;
6+
}
7+
8+
/**
9+
*
10+
*
11+
* @example
12+
* ```tsx
13+
* <RotatingCube />
14+
* ```
15+
*
16+
* @source - Source code
17+
*/
18+
export const RotatingCube = ({ children, ...props }: RotatingCubeProps) => {
19+
const className = [props.className, styles["rotating-cube"]].filter(Boolean).join(" ");
20+
return (
21+
<div {...props} className={className} data-testid="rotating-cube">
22+
{children}
23+
</div>
24+
);
25+
}

0 commit comments

Comments
 (0)