Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into dev
  • Loading branch information
gaurangrshah committed Apr 8, 2024
2 parents ba55146 + 67d7544 commit c5370f3
Show file tree
Hide file tree
Showing 10 changed files with 206 additions and 79 deletions.
28 changes: 27 additions & 1 deletion content/docs/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,34 @@ title : Changelog
description : All last changes in the project with announcements
---

## April 2024 - RTL support, new member

## March 2024 - New docs
### RTL support

One of the most missing features is the RTL support for the components, so we provided the fix for that, so now every component in the registry gonna make the write adjusments for the ui and functionality based on the dir property.

#### Example

This example showcases the carousel component

<ComponentPreview name="carousel-rtl-support" />

<Alert className="mt-4" variant="info">
<MdxIcons.AlertTriangle className="size-4" />
<AlertTitle>Good to know</AlertTitle>
<AlertDescription>
The carousel component has 2 ways for the direction one is using the `dir` prop , and the other one is to use `carouselOptions` as the embla carousel provides a <Link target="_blank" href="https://www.embla-carousel.com/api/options/#direction" className="font-semibold" >
Direction prop</Link> that suport both
</AlertDescription>
</Alert>

### New team member

This is project is growing up, and this is cool to see from the community, but a lot of parts are missing, so I want you all to welcome a new team member <Link target="_blank" href="https://twitter.com/Soham_Asmi" className="font-semibold" >@Gaurang</Link>, together, we feel confident that we can deliver the tools you need to easily build accessible modern UIs faster than ever before.



## March 2024 - New Docs

We are happy to announce that we have updated our documentation. We have added new features. We hope you will find it useful. If you have any questions or suggestions, please let us know.

Expand Down
4 changes: 2 additions & 2 deletions contentlayer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
defineDocumentType,
defineNestedType,
makeSource,
} from "@contentlayer-temp/source-files";
} from "@contentlayer2/source-files";
import rehypePrettyCode from "rehype-pretty-code";
import rehypeSlug from "rehype-slug";
import { codeImport } from "remark-code-import";
Expand All @@ -11,7 +11,7 @@ import { visit } from "unist-util-visit";
import { rehypeComponent } from "./src/lib/rehype-component";
import { rehypeNpmCommand } from "./src/lib/rehype-installation-command";

/** @type {import('@contentlayer-temp/source-files').ComputedFields} */
/** @type {import('@contentlayer2/source-files').ComputedFields} */
const computedFields = {
slug: {
type: "string",
Expand Down
2 changes: 1 addition & 1 deletion next.config.mjs → next.config.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContentlayerPlugin } from "next-contentlayer-temp";
import { createContentlayerPlugin } from "next-contentlayer2";

/** @type {import('next').NextConfig} */
const nextConfig = {
Expand Down
138 changes: 69 additions & 69 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"private": true,
"scripts": {
"dev": "next dev --turbo",
"build": "contentlayer-temp build && npm run build:registry && next build",
"build": "contentlayer2 build && npm run build:registry && next build",
"start": "next start",
"lint": "next lint",
"build:test": "npm run typecheck && npm run build:registry && next build && next start -p 3001",
"build:registry": "npx tsx --tsconfig ./src/script/tsconfig.scripts.json ./src/script/registry-builder.ts",
"typecheck": "contentlayer-temp build && tsc --noEmit",
"typecheck": "contentlayer2 build && tsc --noEmit",
"watch": "contentlayer2 dev && tsc --noEmit",
"format": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache"
},
"dependencies": {
Expand All @@ -34,7 +35,7 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"cmdk": "^0.2.1",
"contentlayer-temp": "^0.4.4",
"contentlayer2": "^0.4.4",
"date-fns": "^3.3.1",
"embla-carousel": "^8.0.1",
"embla-carousel-auto-scroll": "^8.0.1",
Expand All @@ -45,7 +46,7 @@
"mdast-util-toc": "^7.0.0",
"mini-svg-data-uri": "^1.4.4",
"next": "^14.1.2",
"next-contentlayer-temp": "^0.4.4",
"next-contentlayer2": "^0.4.4",
"next-themes": "^0.2.1",
"posthog-js": "^1.116.5",
"react": "^18",
Expand Down
7 changes: 7 additions & 0 deletions src/__registry__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ export const Index: Record<string, any> = {
component: React.lazy(() => import("@/registry/default/example/carousel/carousel-indicator.tsx")),
files: ["src/registry/default/example/carousel/carousel-indicator.tsx"],
},
"carousel-rtl-support": {
name: "carousel-rtl-support",
type: "components:example",
registryDependencies: ["carousel"],
component: React.lazy(() => import("@/registry/default/example/carousel/carousel-rtl-support.tsx")),
files: ["src/registry/default/example/carousel/carousel-rtl-support.tsx"],
},
"multi-select-state": {
name: "multi-select-state",
type: "components:example",
Expand Down
2 changes: 1 addition & 1 deletion src/components/mdx-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as React from "react";
import Image from "next/image";
import Link from "next/link";
import { useMDXComponent } from "next-contentlayer-temp/hooks";
import { useMDXComponent } from "next-contentlayer2/hooks";
import { NpmCommands } from "../types/unist";
import { Event } from "@/lib/events";
import { cn } from "@/lib/utils";
Expand Down
6 changes: 6 additions & 0 deletions src/registry/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ const examples: Registry = [
registryDependencies: ["carousel"],
files: ["example/carousel/carousel-indicator.tsx"],
},
{
name: "carousel-rtl-support",
type: "components:example",
registryDependencies: ["carousel"],
files: ["example/carousel/carousel-rtl-support.tsx"],
},
{
name: "multi-select-state",
type: "components:example",
Expand Down
87 changes: 87 additions & 0 deletions src/registry/default/example/carousel/carousel-rtl-support.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
"use client";

import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import {
Carousel,
CarouselMainContainer,
CarouselNext,
CarouselPrevious,
SliderMainItem,
CarouselThumbsContainer,
SliderThumbItem,
CarouselIndicator,
} from "@/registry/default/extension/carousel";
import { useState } from "react";

const CarouselOrientation = () => {
const [direction, setDirection] = useState<DirectionType>("ltr");
return (
<>
<Carousel dir={direction}>
<CarouselNext />
<CarouselPrevious />
<CarouselMainContainer className="h-60">
{Array.from({ length: 5 }).map((_, index) => (
<SliderMainItem key={index} className="bg-transparent">
<div className="outline outline-1 outline-border size-full flex items-center justify-center rounded-xl bg-background">
Slide {index + 1}
</div>
</SliderMainItem>
))}
</CarouselMainContainer>
<div className="absolute bottom-2 left-1/2 -translate-x-1/2">
<CarouselThumbsContainer className="gap-x-1 ">
{Array.from({ length: 5 }).map((_, index) => (
<CarouselIndicator key={index} index={index} />
))}
</CarouselThumbsContainer>
</div>
</Carousel>
<SelectDirection direction={direction} setDirection={setDirection} />
</>
);
};

export default CarouselOrientation;

type DirectionType = "rtl" | "ltr";

const OPTIONS = ["rtl", "ltr"];

const SelectDirection = ({
direction,
setDirection,
}: {
direction: DirectionType;
setDirection: (direction: DirectionType) => void;
}) => {
return (
<div className="absolute right-2 top-2">
<Select
defaultValue="ghost"
value={direction}
onValueChange={setDirection}
>
<SelectTrigger className="px-2 h-8 bg-background text-sm w-32">
<SelectValue>
<span className="text-muted-foreground text-xs">Variant : </span>
<span>{direction}</span>
</SelectValue>
</SelectTrigger>
<SelectContent align="end">
{OPTIONS.map((opt, index) => (
<SelectItem key={`${opt}-${index}`} value={opt} className="text-sm">
{opt}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
);
};
2 changes: 1 addition & 1 deletion src/registry/default/extension/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const Carousel = forwardRef<
break;
}
},
[emblaMainApi, orientation]
[emblaMainApi, orientation, direction]
);

const onThumbClick = useCallback(
Expand Down

0 comments on commit c5370f3

Please sign in to comment.