Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix responsive landing page and light mode issues #79

Merged
merged 29 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c1df784
Fix responsive landing page and light mode issues
ruru-m07 Oct 18, 2024
7f519bd
feat(components): introduce new stack component
ruru-m07 Oct 19, 2024
e62c391
fix(command): Fix inconsistency in Yarn installation command
ruru-m07 Oct 19, 2024
9b85052
fix(props): Fix formatting in props table for 'direction' prop.
ruru-m07 Oct 19, 2024
d955e2e
fix(typo): Fix typo in import statement
ruru-m07 Oct 19, 2024
4eb66e1
fix(comment): Fix code comment in visibility example
ruru-m07 Oct 19, 2024
0ae6d4c
Merge branch 'feat/stack' of https://github.com/ruru-m07/ruru-ui into…
ruru-m07 Oct 19, 2024
fa263bc
fix(props): Fix formatting in props table for 'justify' props.
ruru-m07 Oct 19, 2024
210dbb6
fix(stack): Ensure width and height Handle Units Correctly
ruru-m07 Oct 19, 2024
3321427
Merge branch 'feat/stack' of https://github.com/ruru-m07/ruru-ui into…
ruru-m07 Oct 19, 2024
1995783
feat(memoizing): Consider memoizing the Stack component for performan…
ruru-m07 Oct 19, 2024
894b8b4
Merge pull request #80 from ruru-m07/feat/stack
ruru-m07 Oct 19, 2024
2acf2ae
feat(modal): enhance modal component with multiple animation variants
ruru-m07 Oct 20, 2024
60360bb
fix(key): Add key prop to mapped SelectItem components
ruru-m07 Oct 20, 2024
8de720b
fix(mapping): Use Unique Keys Instead of Index in Lists
ruru-m07 Oct 20, 2024
21baf80
fix(docs: props): Update the animationVariant prop type and description
ruru-m07 Oct 20, 2024
4928f5b
feat(submissionStatus): Consider enhancing the handleSubmit function
ruru-m07 Oct 20, 2024
36a4446
fix(component: type): Specify a more precise return type for the comp…
ruru-m07 Oct 20, 2024
8c6833a
Merge pull request #81 from ruru-m07/enhance-modal-animations
ruru-m07 Oct 20, 2024
17fed7e
refactor(component: switch): make Switch component self-dependent by …
ruru-m07 Oct 20, 2024
c4159ab
fix(lint): resolve linting errors
ruru-m07 Oct 20, 2024
b018ad7
feat(switch): support controlled and uncontrolled usage
ruru-m07 Oct 20, 2024
3a94dd6
feat(error-handling): add error handling and verbose output
ruru-m07 Oct 20, 2024
45e5496
chore(deps): bump package version from 2.2.4 to 2.2.5
ruru-m07 Oct 20, 2024
62c6dea
Merge branch 'refactor-switch-component' of https://github.com/ruru-m…
ruru-m07 Oct 20, 2024
6426efb
Merge pull request #82 from ruru-m07/refactor-switch-component
ruru-m07 Oct 20, 2024
cd4378d
Fix responsive landing page and light mode issues
ruru-m07 Oct 18, 2024
f9805d8
fix(ui): resolve landing page responsiveness and light mode problems
ruru-m07 Oct 20, 2024
9c4fac1
Merge branch 'fix-responsive-landing-page' of https://github.com/ruru…
ruru-m07 Oct 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ yarn-error.log*
# Misc
.DS_Store
*.pem
.tmp
15 changes: 14 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
pnpm run --filter=./apps/www build:registry && pnpm prettier
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo "Running pre-commit hook..."
if ! pnpm run --filter=./apps/www build:registry; then
echo "Error: Failed to build registry. Commit aborted."
exit 1
fi
echo "Registry built successfully. Running Prettier..."
if ! pnpm prettier; then
echo "Error: Prettier formatting failed. Commit aborted."
exit 1
fi
echo "Pre-commit hook completed successfully."
2 changes: 1 addition & 1 deletion apps/www/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function Layout({ children }: { children: ReactNode }) {
>
<body>
<CSPostHogProvider>
<RootProvider>
<RootProvider theme={{ defaultTheme: "dark" }}>
<RuruProvider>
<ScrollArea className="h-screen">{children}</ScrollArea>
</RuruProvider>
Expand Down
31 changes: 20 additions & 11 deletions apps/www/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React from "react";
"use client";

import React, { useEffect } from "react";
import Hero from "@/components/hero";
import {
Heart,
Expand Down Expand Up @@ -34,6 +36,13 @@ const CodeBlockServer = dynamic(
);

export default function HomePage() {
useEffect(() => {
if (localStorage.getItem("theme") === "light") {
localStorage.setItem("theme", "dark");
window.location.reload();
}
}, []);

const data = {
initTerminalText: `npx ruru-ui-cli@latest init

Expand Down Expand Up @@ -116,7 +125,7 @@ export default function App() {
</h2>
</div>
<ShapratorHorizontal />
<div className="grid grid-cols-2">
<div className="grid grid-cols-1 sm:grid-cols-2">
<div className="border-r p-4 py-6">
<StepCounter count={1} />
<h4 className="text-xl font-bold">Initialize.</h4>
Expand All @@ -143,7 +152,7 @@ export default function App() {
<div className="flex flex-col items-center justify-center py-4">
<StepCounter count={3} className="mb-0 mt-4" />
<h4 className="text-xl font-bold">Use components.</h4>
<p className="text-muted-foreground mt-2">
<p className="text-muted-foreground mt-2 text-sm">
costomize and integrate components in your project. 🚀
</p>

Expand Down Expand Up @@ -203,7 +212,7 @@ export default function App() {

<ShapratorHorizontal />

<div className="grid grid-cols-3 grid-rows-2">
<div className="grid sm:grid-cols-1 md:grid-cols-3 grid-rows-2">
<div className="border-r px-6 py-12 hover:bg-primary-foreground/70">
<div className="mb-4 flex flex-row items-center gap-2 text-muted-foreground">
<Settings2
Expand Down Expand Up @@ -381,8 +390,8 @@ export default function App() {

<ShapratorHorizontal />

<div className="flex">
<Link href={"/theme"} className="w-1/2 border-r">
<div className="flex sm:flex-row">
<Link href={"/theme"} className="w-full md:w-1/2 border-r">
<div className="z-10 p-4">
<div className="flex items-center ml-5 mt-5">
<Palette size={20} strokeWidth={1.5} className="mr-2" />
Expand All @@ -401,7 +410,7 @@ export default function App() {
/>
</div>
</Link>
<Link href={"/blocks"} className="w-1/2 bg-[#080808]">
<Link href={"/blocks"} className="w-full md:w-1/2 bg-[#080808]">
<div className="z-10 p-4">
<div className="flex items-center ml-5 mt-5">
<LayoutTemplate
Expand Down Expand Up @@ -443,18 +452,18 @@ export default function App() {

<ShapratorHorizontal />

<div className="flex items-center">
<h1 className="text-2xl font-bold w-1/3 text-muted-foreground flex items-center justify-center p-4">
<div className="grid md:grid-cols-3">
<h1 className="text-2xl font-bold text-muted-foreground flex items-center justify-center p-4">
Build Your Components.
</h1>
<div className="w-1/3 p-4 border-l border-r">
<div className="p-4 border-l border-r">
<span className="text-muted-foreground">Available now</span>
<CodeBlockServer
lang="bash"
code={[`npx ruru-ui-cli@latest init`]}
/>
</div>
<div className="text-2xl font-bold w-1/3 text-muted-foreground h-full flex items-center justify-center p-4 space-x-4">
<div className="text-2xl font-bold text-muted-foreground h-full flex items-center justify-center p-4 space-x-4">
<Link
className={cn(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
Expand Down
36 changes: 35 additions & 1 deletion apps/www/app/playground/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ import {
SelectSeparator,
selectAnimationVariants,
} from "ruru-ui/components/select";
import Modal, { ModalProvider } from "ruru-ui/components/modal";
import Modal, { ModalProvider, modalVariants } from "ruru-ui/components/modal";
import { Dropzone } from "ruru-ui/components/dropzone";
import AdvanceDropzone from "@/components/preview/dropzone/advanceDropzone";
import StackPlayground from "@/components/stackPlayground";

const Playground = () => {
const handleSubmit = async () => {
Expand Down Expand Up @@ -609,6 +610,37 @@ const Playground = () => {
</ModalProvider>
</Card>

{(Object.keys(modalVariants) as Array<keyof typeof modalVariants>).map(
(variantKey) => (
<Card key={variantKey}>
<ModalProvider>
<Modal.Trigger>Open {variantKey} Modal</Modal.Trigger>
<Modal animationVariant={variantKey}>
<Modal.Body>
<Modal.Header>
<Modal.Title>Create Username</Modal.Title>
<Modal.Subtitle>
Enter a unique name for your token to differentiate it
from other tokens and then select the scope.
</Modal.Subtitle>
</Modal.Header>
<Modal.Content>
<Input
label="username"
placeholder="enter your username."
/>
</Modal.Content>
</Modal.Body>
<Modal.Actions>
<Modal.Close variant="secondary">Cancel</Modal.Close>
<Modal.Action onClick={handleSubmit}>Submit</Modal.Action>
</Modal.Actions>
</Modal>
</ModalProvider>
</Card>
ruru-m07 marked this conversation as resolved.
Show resolved Hide resolved
),
)}

<Card className="p-10">
<Dropzone onDrop={(acceptedFiles) => console.log(acceptedFiles)} />
</Card>
Expand All @@ -617,6 +649,8 @@ const Playground = () => {
<AdvanceDropzone />
</Card>

<StackPlayground />

<div className="my-10" />
</div>
);
Expand Down
8 changes: 4 additions & 4 deletions apps/www/components/SwitchEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
import React, { useState } from "react";
import { Switch } from "ruru-ui/components/switch";

const SwiychEvent = (): React.ReactNode => {
const SwitchEvent = (): React.ReactNode => {
const [value, setValue] = useState<boolean>(false);
return (
<div className="flex flex-col justify-center items-center">
<div className="flex items-center space-x-2">
<Switch onCheckedChange={(e) => setValue(e)} id="toggle-animation" />
<label htmlFor="toggle value"> toggle value </label>
<Switch onCheckedChange={(e) => setValue(e)} id="toggle-value" />
<label htmlFor="toggle-value"> toggle value </label>
</div>
<p>{String(value)}</p>
</div>
);
};

export default SwiychEvent;
export default SwitchEvent;
38 changes: 27 additions & 11 deletions apps/www/components/contributor-count.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { HTMLAttributes } from "react";
"use client";

import { useEffect, useState, type HTMLAttributes } from "react";
import Image from "next/image";
import { cn } from "@/utils/cn";
import { fetchContributors } from "@/utils/get-contributors";
import { Contributor, fetchContributors } from "@/utils/get-contributors";

export interface ContributorCounterProps
extends HTMLAttributes<HTMLDivElement> {
Expand All @@ -10,16 +12,28 @@ export interface ContributorCounterProps
displayCount?: number;
}

export default async function ContributorCounter({
const ContributorCounter = ({
repoOwner,
repoName,
displayCount = 20,
...props
}: ContributorCounterProps): Promise<React.ReactElement> {
const contributors = await fetchContributors(repoOwner, repoName);
const topContributors = contributors
.filter((contributor) => contributor.login !== "turbobot-temp")
.slice(0, displayCount);
}: ContributorCounterProps): React.ReactNode => {
const [topContributors, setTopContributors] = useState<Contributor[] | []>(
[],
);

async function fetchDtata() {
const contributors = await fetchContributors(repoOwner, repoName);
ruru-m07 marked this conversation as resolved.
Show resolved Hide resolved
const topContributors = contributors
.filter((contributor) => contributor.login !== "turbobot-temp")
.slice(0, displayCount);

setTopContributors(topContributors);
}

useEffect(() => {
fetchDtata();
}, []);

return (
<div
Expand Down Expand Up @@ -47,12 +61,14 @@ export default async function ContributorCounter({
/>
</a>
))}
{displayCount < contributors.length ? (
{displayCount < topContributors.length ? (
<div className="size-12 content-center rounded-full bg-fd-secondary text-center">
+{contributors.length - displayCount}
+{topContributors.length - displayCount}
</div>
) : null}
</div>
</div>
);
}
};

export default ContributorCounter;
2 changes: 1 addition & 1 deletion apps/www/components/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
export default function Header() {
return (
<header
className={`h-[80px] space-x-4 flex items-center justify-between w-full my-4 border rounded-md`}
className={`h-[80px] space-x-4 flex items-center justify-between w-full my-4 border rounded-md px-4 md:px-8`}
>
<div className="flex items-center space-x-2 w-full pr-5">
<div className="flex items-center w-full space-x-4 ml-4">
Expand Down
94 changes: 94 additions & 0 deletions apps/www/components/preview/Modal/modalAnimation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
"use client";

import React, { useState } from "react";
import { Stack } from "ruru-ui/components/stack";
import {
Select,
SelectGroup,
SelectValue,
SelectTrigger,
SelectContent,
SelectLabel,
SelectItem,
SelectSeparator,
} from "ruru-ui/components/select";
import Modal, { ModalProvider, modalVariants } from "ruru-ui/components/modal";
import { Input } from "ruru-ui/components/input";
import { Spinner } from "ruru-ui/components/spinner";

const ModalAnimation = (): JSX.Element => {
const [selectedVariant, setSelectedVariant] = useState<string>("default");
ruru-m07 marked this conversation as resolved.
Show resolved Hide resolved
const [submissionStatus, setSubmissionStatus] = useState<
"idle" | "loading" | "success" | "error"
>("idle");

const handleSubmit = async () => {
setSubmissionStatus("loading");
try {
// Your submit logic here
console.log(`Submitting with variant: ${selectedVariant}`);
// Simulate an API call or any async operation
await new Promise((resolve) => setTimeout(resolve, 1000));
setSubmissionStatus("success");
} catch (error) {
console.error("Submission failed:", error);
setSubmissionStatus("error");
}
};

return (
<Stack direction={"column"} justify={"center"} align={"center"} gap={20}>
<Select
onValueChange={(e) => setSelectedVariant(e)}
defaultValue="default"
>
<SelectTrigger className="w-[180px]">
<SelectValue placeholder="Select a animation variants" />
ruru-m07 marked this conversation as resolved.
Show resolved Hide resolved
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectLabel>variants</SelectLabel>
<SelectSeparator />
{(
Object.keys(modalVariants) as Array<keyof typeof modalVariants>
).map((variantKey) => (
<SelectItem key={variantKey} value={variantKey}>
{variantKey}
</SelectItem>
))}
</SelectGroup>
</SelectContent>
</Select>
<ModalProvider>
<Modal.Trigger>Open {selectedVariant} Modal</Modal.Trigger>
<Modal animationVariant={selectedVariant as keyof typeof modalVariants}>
<Modal.Body>
<Modal.Header>
<Modal.Title>Create Username</Modal.Title>
<Modal.Subtitle>
Enter a unique name for your token to differentiate it from
other tokens and then select the scope.
</Modal.Subtitle>
ruru-m07 marked this conversation as resolved.
Show resolved Hide resolved
</Modal.Header>
<Modal.Content>
<Input label="username" placeholder="enter your username." />
</Modal.Content>
</Modal.Body>
<Modal.Actions>
<Modal.Close variant="secondary">Cancel</Modal.Close>
<Modal.Action
disabled={submissionStatus === "loading"}
variant={submissionStatus === "loading" ? "secondary" : "default"}
onClick={handleSubmit}
>
{submissionStatus === "loading" && <Spinner className="mr-2" />}{" "}
Submit
</Modal.Action>
</Modal.Actions>
</Modal>
</ModalProvider>
</Stack>
);
};

export default ModalAnimation;
Loading