Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
carina-akaia committed Sep 11, 2024
1 parent 8047228 commit e7a6f92
Show file tree
Hide file tree
Showing 32 changed files with 302 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from "react";
import * as AccordionPrimitive from "@radix-ui/react-accordion";
// import { ChevronDown } from "lucide-react";

import { cn } from "../utils";
import { cn } from "../../utils";

const Accordion = AccordionPrimitive.Root;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { forwardRef } from "react";

import { type VariantProps, cva } from "class-variance-authority";

import { cn } from "../utils";
import { cn } from "../../utils";

const alertVariants = cva(
cn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";

import * as AvatarPrimitive from "@radix-ui/react-avatar";

import { cn } from "../utils";
import { cn } from "../../utils";

const Avatar = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Root>,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { type VariantProps, cva } from "class-variance-authority";

import { cn } from "../utils";
import { cn } from "../../utils";

// TODO: add correct hover effects
const buttonVariants = cva(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChevronLeft, ChevronRight } from "lucide-react";
import { DayPicker } from "react-day-picker";

import { buttonVariants } from "./button";
import { cn } from "../utils";
import { cn } from "../../utils";

export type CalendarProps = React.ComponentProps<typeof DayPicker>;

Expand Down
86 changes: 86 additions & 0 deletions src/common/ui/components/atoms/card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import * as React from "react";

import { cn } from "../../utils";

const Card = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"rounded-lg border bg-card text-card-foreground shadow-sm",
className,
)}
{...props}
/>
));
Card.displayName = "Card";

const CardHeader = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex flex-col space-y-1.5 p-6", className)}
{...props}
/>
));
CardHeader.displayName = "CardHeader";

const CardTitle = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
<h3
ref={ref}
className={cn(
"text-2xl font-semibold leading-none tracking-tight",
className,
)}
{...props}
/>
));
CardTitle.displayName = "CardTitle";

const CardDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
<p
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
));
CardDescription.displayName = "CardDescription";

const CardContent = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
));
CardContent.displayName = "CardContent";

const CardFooter = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex items-center p-6 pt-0", className)}
{...props}
/>
));
CardFooter.displayName = "CardFooter";

export {
Card,
CardHeader,
CardFooter,
CardTitle,
CardDescription,
CardContent,
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { forwardRef } from "react";
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
import { Check } from "lucide-react";

import { cn } from "../utils";
import { cn } from "../../utils";

export const Checkbox = forwardRef<
React.ElementRef<typeof CheckboxPrimitive.Root>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from "react";
import * as SelectPrimitive from "@radix-ui/react-select";
import { Check, ChevronDown, ChevronUp } from "lucide-react";

import { cn } from "../utils";
import { cn } from "../../utils";

const Select = SelectPrimitive.Root;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";

import * as SwitchPrimitives from "@radix-ui/react-switch";

import { cn } from "../utils";
import { cn } from "../../utils";

const Switch = React.forwardRef<
React.ElementRef<typeof SwitchPrimitives.Root>,
Expand Down
38 changes: 25 additions & 13 deletions src/common/ui/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
export * from "./accordion";
export * from "./alert";
export * from "./avatar";
export * from "./button";
export * from "./calendar";
export * from "./checkbox";
export * from "./clipboard-copy-button";
export * from "./dialog";
/**
* Yet to be sorted in accordance to the Atomic Design principles
*
* See https://atomicdesign.bradfrost.com/chapter-2/
*/
export * from "./dropdown-menu";
export * from "./Filter";
export * from "./form";
export * from "./InfiniteScroll";
export * from "./input";
Expand All @@ -16,23 +12,39 @@ export * from "./popover";
export * from "./radio-group";
export * from "./scroll-area";
export * from "./SearchBar";
export * from "./select";
export * from "./skeleton";
export * from "./SortSelect";
export * from "./Spinner";
export * from "./switch";
export * from "./textarea";
export * from "./toggle";
export * from "./toggle-group";
export * from "./typography";
export * from "./custom-avatar";

/**
* Atoms
*
* See https://atomicdesign.bradfrost.com/chapter-2/#atoms
*/
export * from "./atoms/accordion";
export * from "./atoms/alert";
export * from "./atoms/avatar";
export * from "./atoms/badge";
export * from "./atoms/button";
export * from "./atoms/calendar";
export * from "./atoms/card";
export * from "./atoms/checkbox";
export * from "./atoms/select";
export * from "./atoms/switch";

/**
* Molecules
*
* See https://atomicdesign.bradfrost.com/chapter-2/#molecules
*/
export * from "./molecules/clipboard-copy-button";
export * from "./molecules/data-loading-placeholder";
export * from "./molecules/dialog";
export * from "./molecules/filter";
export * from "./molecules/sort-select";

/**
* Organisms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { type DialogProps } from "@radix-ui/react-dialog";
import { Command as CommandPrimitive } from "cmdk";
import { Search } from "lucide-react";

import { cn } from "@/common/ui/utils";

import { Dialog, DialogContent } from "./dialog";
import { cn } from "../../utils";

const Command = React.forwardRef<
React.ElementRef<typeof CommandPrimitive>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { forwardRef } from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { ArrowLeft, X } from "lucide-react";

import { Button } from "./button";
import { cn } from "../utils";
import { cn } from "../../utils";
import { Button } from "../atoms/button";

const Dialog = DialogPrimitive.Root;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { PopoverProps } from "@radix-ui/react-popover";
import { ToggleGroupMultipleProps } from "@radix-ui/react-toggle-group";
import Image from "next/image";

import { Button } from "./button";
import { Label } from "./label";
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
import { ToggleGroup, ToggleGroupItem } from "./toggle-group";
import { Button } from "../atoms/button";
import { Label } from "../label";
import { Popover, PopoverContent, PopoverTrigger } from "../popover";
import { ToggleGroup, ToggleGroupItem } from "../toggle-group";

// Define the item type
type Item = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import React, {
import { Command as CommandPrimitive } from "cmdk";
import { Check, X as RemoveIcon } from "lucide-react";

import { Badge } from "./badge";
// import { Command, CommandEmpty, CommandItem, CommandList } from "./command";
import { Command, CommandList } from "./command";
import { cn } from "../utils";
import { cn } from "../../utils";
import { Badge } from "../atoms/badge";
// import { Command, CommandEmpty, CommandItem, CommandList } from "./command";

type MultiSelectorProps = {
values: string[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SelectProps, Trigger } from "@radix-ui/react-select";
import Image from "next/image";

import { Button } from "./button";
import { Select, SelectContent, SelectItem } from "./select";
import { Button } from "../atoms/button";
import { Select, SelectContent, SelectItem } from "../atoms/select";

export const SortSelect = ({
options,
Expand Down
6 changes: 3 additions & 3 deletions src/modules/pot/components/FundMatchingPoolModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import { Form } from "react-hook-form";
import { Pot } from "@/common/api/potlock";
import { yoctoNearToFloat } from "@/common/lib";
import {
Badge,
Button,
Checkbox,
CustomAvatar,
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
FormField,
Input,
Spinner,
Textarea,
} from "@/common/ui/components";
import { Badge } from "@/common/ui/components/badge";
import Spinner from "@/common/ui/components/Spinner";
import routesPath from "@/modules/core/routes";
import { CustomAvatar } from "@/modules/profile";
import { useTypedSelector } from "@/store";

import { useFundMatchingPoolForm, useProtocolConfig } from "../hooks";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import AdminIcon from "@/common/assets/svgs/AdminIcon";
import { Challenge as ChallengeType } from "@/common/contracts/potlock/interfaces/pot.interfaces";
import * as potContract from "@/common/contracts/potlock/pot";
import getTimePassed from "@/common/lib/getTimePassed";
import { CustomAvatar } from "@/common/ui/components";
import routesPath from "@/modules/core/routes";
import { CustomAvatar } from "@/modules/profile";
import { useTypedSelector } from "@/store";

import { Challenge, Container, Line, Table, Title } from "./styles";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import Link from "next/link";

import { Toggle } from "@/common/assets/svgs";
import { truncate } from "@/common/lib";
import { CustomAvatar } from "@/common/ui/components";
import { oneNearUsdPrice } from "@/modules/core";
import routesPath from "@/modules/core/routes";
import { JoinDonation } from "@/modules/pot/hooks";
import { CustomAvatar } from "@/modules/profile";
import useProfileData from "@/modules/profile/hooks/useProfileData";

import { Container, Row } from "./styles";
Expand Down
2 changes: 1 addition & 1 deletion src/modules/pot/components/SponsorsBoard/SponsorsBoard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Link from "next/link";

import { truncate } from "@/common/lib";
import { CustomAvatar } from "@/common/ui/components";
import routesPath from "@/modules/core/routes";
import { CustomAvatar } from "@/modules/profile";
import useProfileData from "@/modules/profile/hooks/useProfileData";

import { Container } from "./styles";
Expand Down
2 changes: 1 addition & 1 deletion src/modules/pot/components/SponsorsTable/SponsorsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useEffect, useState } from "react";
import Link from "next/link";

import { truncate } from "@/common/lib";
import { CustomAvatar } from "@/common/ui/components";
import {
Tooltip,
TooltipContent,
Expand All @@ -12,6 +11,7 @@ import {
} from "@/common/ui/components/tooltip";
import Pagination from "@/modules/core/components/Pagination";
import routesPath from "@/modules/core/routes";
import { CustomAvatar } from "@/modules/profile";

import { Container, NoResult, Percentage, TrRow } from "./styles";
import { CustomDonationType } from "../../models/types";
Expand Down
2 changes: 1 addition & 1 deletion src/modules/profile/components/FollowButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useState } from "react";

import { getSocialData, setSocialData } from "@/common/contracts/social";
import { Button } from "@/common/ui/components/button";
import { Button } from "@/common/ui/components";
import useWallet from "@/modules/auth/hooks/useWallet";

type Props = {
Expand Down
3 changes: 1 addition & 2 deletions src/modules/profile/components/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import CheckIcon from "@/common/assets/svgs/CheckIcon";
import ReferrerIcon from "@/common/assets/svgs/ReferrerIcon";
import { DEFAULT_URL } from "@/common/constants";
import truncate from "@/common/lib/truncate";
import { ClipboardCopyButton } from "@/common/ui/components";
import { Button } from "@/common/ui/components/button";
import { Button, ClipboardCopyButton } from "@/common/ui/components";
import { useAuth } from "@/modules/auth/hooks/useAuth";
import useWallet from "@/modules/auth/hooks/useWallet";
import routesPath from "@/modules/core/routes";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useState } from "react";

import useProfileData from "@/modules/profile/hooks/useProfileData";
import useProfileData from "../hooks/useProfileData";

const NO_IMAGE =
"https://ipfs.near.social/ipfs/bafkreiccpup6f2kihv7bhlkfi4omttbjpawnsns667gti7jbhqvdnj4vsm";
Expand Down
1 change: 1 addition & 0 deletions src/modules/profile/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./components/custom-avatar";
export { ProfileLink } from "./components/ProfileLink";
export { ProfileLayout } from "./components/ProfileLayout";
export { profilesModel, navModel } from "./models";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
MultiSelectorItem,
MultiSelectorList,
MultiSelectorTrigger,
} from "@/common/ui/components/multi-select";
} from "@/common/ui/components/molecules/multi-select";
import useProfileData from "@/modules/profile/hooks/useProfileData";
import { useTypedSelector } from "@/store";

Expand Down
Loading

0 comments on commit e7a6f92

Please sign in to comment.