-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from LerianStudio/feature/transactions-create
✨ Create Transactions: First batch of functionality
- Loading branch information
Showing
21 changed files
with
438 additions
and
26 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/app/(routes)/transactions/create/operation-empty-accordion.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export type OperationEmptyAccordionProps = { | ||
title: string | ||
description?: string | ||
} | ||
|
||
export const OperationEmptyAccordion = ({ | ||
title, | ||
description | ||
}: OperationEmptyAccordionProps) => { | ||
return ( | ||
<div className="mb-6 flex flex-row rounded-xl border border-dashed border-zinc-300 p-6"> | ||
<div className="flex flex-col gap-2"> | ||
<p className="text-sm font-medium">{title}</p> | ||
<p className="text-sm font-medium text-shadcn-400">{description}</p> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { useIntl } from 'react-intl' | ||
import { | ||
Stepper as PrimitiveStepper, | ||
StepperItem, | ||
StepperItemNumber, | ||
StepperItemText | ||
} from '../primitives/stepper' | ||
|
||
export type StepperProps = { | ||
step?: number | ||
} | ||
|
||
export const Stepper = ({ step = 0 }: StepperProps) => { | ||
const intl = useIntl() | ||
|
||
return ( | ||
<PrimitiveStepper> | ||
<StepperItem active={step === 0}> | ||
<StepperItemNumber>1</StepperItemNumber> | ||
<StepperItemText | ||
title={intl.formatMessage({ | ||
id: 'transactions.create.stepper.first', | ||
defaultMessage: 'Transaction Data' | ||
})} | ||
/> | ||
</StepperItem> | ||
<StepperItem active={step === 1}> | ||
<StepperItemNumber>2</StepperItemNumber> | ||
<StepperItemText | ||
title={intl.formatMessage({ | ||
id: 'transactions.create.stepper.second', | ||
defaultMessage: 'Operations and Metadata' | ||
})} | ||
/> | ||
</StepperItem> | ||
<StepperItem active={step === 2}> | ||
<StepperItemNumber>3</StepperItemNumber> | ||
<StepperItemText | ||
title={intl.formatMessage({ | ||
id: 'transactions.create.stepper.third', | ||
defaultMessage: 'Review' | ||
})} | ||
description={intl.formatMessage({ | ||
id: 'transactions.create.stepper.third.description', | ||
defaultMessage: | ||
'Check the values and parameters entered and confirm to create the transaction.' | ||
})} | ||
/> | ||
</StepperItem> | ||
</PrimitiveStepper> | ||
) | ||
} |
55 changes: 55 additions & 0 deletions
55
src/app/(routes)/transactions/primitives/paper-collapsible.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { ElementRef, forwardRef, HTMLAttributes } from 'react' | ||
import { cn } from '@/lib/utils' | ||
import { | ||
CollapsibleProps, | ||
CollapsibleTriggerProps | ||
} from '@radix-ui/react-collapsible' | ||
import { | ||
Collapsible, | ||
CollapsibleContent, | ||
CollapsibleTrigger | ||
} from '@/components/ui/collapsible' | ||
import { Paper } from '@/components/ui/paper' | ||
import { ChevronDown } from 'lucide-react' | ||
|
||
export type PaperCollapsibleProps = CollapsibleProps | ||
|
||
export const PaperCollapsible = forwardRef< | ||
ElementRef<typeof Collapsible>, | ||
PaperCollapsibleProps | ||
>(({ className, children, ...props }, ref) => ( | ||
<Collapsible ref={ref} className="group/paper-collapsible" {...props}> | ||
<Paper className={cn('flex flex-col', className)}>{children}</Paper> | ||
</Collapsible> | ||
)) | ||
PaperCollapsible.displayName = 'PaperCollapsible' | ||
|
||
export const PaperCollapsibleBanner = forwardRef< | ||
HTMLDivElement, | ||
HTMLAttributes<HTMLDivElement> | ||
>(({ className, children, ...props }, ref) => ( | ||
<div ref={ref} className={cn('flex flex-row p-6', className)} {...props}> | ||
<div className="flex flex-grow flex-col">{children}</div> | ||
<PaperCollapsibleTrigger /> | ||
</div> | ||
)) | ||
PaperCollapsibleBanner.displayName = 'PaperCollapsibleBanner' | ||
|
||
export const PaperCollapsibleTrigger = forwardRef< | ||
ElementRef<typeof CollapsibleTrigger>, | ||
CollapsibleTriggerProps | ||
>(({ className, children, ...props }, ref) => ( | ||
<CollapsibleTrigger | ||
ref={ref} | ||
className={cn( | ||
'transition-all hover:underline [&[data-state=open]>svg]:rotate-180', | ||
className | ||
)} | ||
{...props} | ||
> | ||
<ChevronDown className="shrink-0 transition-transform duration-200" /> | ||
</CollapsibleTrigger> | ||
)) | ||
PaperCollapsibleTrigger.displayName = 'PaperCollapsibleTrigger' | ||
|
||
export const PaperCollapsibleContent = CollapsibleContent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { cn } from '@/lib/utils' | ||
import { forwardRef, HTMLAttributes, PropsWithChildren } from 'react' | ||
|
||
export const Stepper = forwardRef< | ||
HTMLDivElement, | ||
HTMLAttributes<HTMLDivElement> | ||
>(({ className, ...props }, ref) => ( | ||
<div ref={ref} className={cn('flex flex-col gap-4', className)} {...props} /> | ||
)) | ||
Stepper.displayName = 'Stepper' | ||
|
||
export type StepperItemProps = HTMLAttributes<HTMLDivElement> & { | ||
active?: boolean | ||
} | ||
|
||
export const StepperItem = forwardRef<HTMLDivElement, StepperItemProps>( | ||
({ className, active, ...props }, ref) => ( | ||
<div | ||
ref={ref} | ||
data-active={active} | ||
className={cn('group flex flex-row gap-3', className)} | ||
{...props} | ||
/> | ||
) | ||
) | ||
StepperItem.displayName = 'StepperItem' | ||
|
||
export const StepperItemNumber = forwardRef< | ||
HTMLDivElement, | ||
HTMLAttributes<HTMLDivElement> | ||
>(({ className, ...props }, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn( | ||
'flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border border-shadcn-400 text-sm font-medium text-shadcn-400 group-data-[active=true]:border-none group-data-[active=true]:bg-white group-data-[active=true]:text-neutral-600 group-data-[active=true]:shadow-md', | ||
className | ||
)} | ||
{...props} | ||
/> | ||
)) | ||
StepperItemNumber.displayName = 'StepperItemNumber' | ||
|
||
export type StepperItemTextProps = HTMLAttributes<HTMLDivElement> & { | ||
title: string | ||
description?: string | ||
} | ||
|
||
export const StepperItemText = forwardRef< | ||
HTMLParagraphElement, | ||
StepperItemTextProps | ||
>(({ className, title, description, ...props }, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn( | ||
'flex flex-col text-sm font-medium text-shadcn-400 group-data-[active=true]:text-neutral-600', | ||
className | ||
)} | ||
{...props} | ||
> | ||
<div className="flex h-8 items-center"> | ||
<p>{title}</p> | ||
</div> | ||
{description && ( | ||
<p className="text-xs group-data-[active=false]:hidden">{description}</p> | ||
)} | ||
</div> | ||
)) | ||
StepperItemText.displayName = 'StepperItemText' | ||
|
||
export type StepperControlProps = PropsWithChildren & { | ||
active?: boolean | ||
} | ||
|
||
export const StepperContent = ({ active, children }: StepperControlProps) => { | ||
return active ? <>{children}</> : null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.