Skip to content

Commit 05adc15

Browse files
committed
fix: format
1 parent 74084fb commit 05adc15

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

.cursor/rules/frontend-dev.mdc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
description: Frontend dev with React, Typescript, shadcn and Tailwind
3+
globs:
4+
alwaysApply: false
5+
---
6+
7+
// TypeScript React .cursorrules
8+
9+
// Prefer functional components
10+
11+
const preferFunctionalComponents = true;
12+
13+
// TypeScript React best practices
14+
15+
const typescriptReactBestPractices = [
16+
"Use React.FC for functional components with props",
17+
"Utilize useState and useEffect hooks for state and side effects",
18+
"Implement proper TypeScript interfaces for props and state",
19+
"Use React.memo for performance optimization when needed",
20+
"Implement custom hooks for reusable logic",
21+
"Utilize TypeScript's strict mode",
22+
];
23+
24+
// Folder structure
25+
26+
const folderStructure = `
27+
src/
28+
components/
29+
hooks/
30+
pages/
31+
utils/
32+
App.tsx
33+
index.tsx
34+
`;
35+
36+
// Additional instructions
37+
38+
const additionalInstructions = `
39+
1. Use .tsx extension for files with JSX
40+
2. Implement strict TypeScript checks
41+
3. Utilize React.lazy and Suspense for code-splitting
42+
4. Use type inference where possible
43+
5. Implement error boundaries for robust error handling
44+
6. Follow React and TypeScript best practices and naming conventions
45+
7. Use ESLint with TypeScript and React plugins for code quality
46+
`;

site/src/components/Slider/Slider.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"use client";
2+
3+
import * as SliderPrimitive from "@radix-ui/react-slider";
4+
import * as React from "react";
5+
6+
import { cn } from "utils/cn";
7+
8+
const Slider = React.forwardRef<
9+
React.ElementRef<typeof SliderPrimitive.Root>,
10+
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
11+
>(({ className, ...props }, ref) => (
12+
<SliderPrimitive.Root
13+
ref={ref}
14+
className={cn(
15+
"relative flex w-full touch-none select-none items-center h-1.5",
16+
className,
17+
)}
18+
{...props}
19+
>
20+
<SliderPrimitive.Track className="relative h-1.5 w-full grow overflow-hidden rounded-full bg-content-secondary">
21+
<SliderPrimitive.Range className="absolute h-full bg-content-primary" />
22+
</SliderPrimitive.Track>
23+
<SliderPrimitive.Thumb className="block h-4 w-4 rounded-full border border-solid border-content-primary bg-surface-primary shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" />
24+
</SliderPrimitive.Root>
25+
));
26+
Slider.displayName = SliderPrimitive.Root.displayName;
27+
28+
export { Slider };

0 commit comments

Comments
 (0)