-
Notifications
You must be signed in to change notification settings - Fork 0
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 #18 from manavsiddharthgupta/develop
[ADDED] collapsible purchased items component
- Loading branch information
Showing
7 changed files
with
213 additions
and
64 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,88 @@ | ||
'use client' | ||
import { Button } from '@/components/ui/button' | ||
import { | ||
Collapsible, | ||
CollapsibleContent, | ||
CollapsibleTrigger | ||
} from '@/components/ui/collapsible' | ||
import { formatAmount } from '@/lib/helpers' | ||
import { ChevronDown, ChevronUp } from 'lucide-react' | ||
import { useState } from 'react' | ||
const CollapsiblePurchasedItems = () => { | ||
const [isopen, setIfOpen] = useState(false) | ||
return ( | ||
<Collapsible open={isopen} onOpenChange={setIfOpen}> | ||
<div className='flex justify-center'> | ||
<CollapsibleTrigger asChild> | ||
<Button | ||
variant='link' | ||
className='text-center flex gap-2 items-center dark:text-sky-300 text-sky-600 hover:no-underline' | ||
> | ||
View Invoice Details | ||
{isopen ? ( | ||
<ChevronUp className='mt-1' /> | ||
) : ( | ||
<ChevronDown className='mt-1' /> | ||
)} | ||
</Button> | ||
</CollapsibleTrigger> | ||
</div> | ||
<CollapsibleContent className='transition-all data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down'> | ||
<h1 className='font-medium text-base'>Purchased Items</h1> | ||
<div className='my-2 border border-zinc-600/20 dark:border-zinc-500/20 rounded-sm'> | ||
<table className='w-full text-sm'> | ||
<thead> | ||
<tr className='text-zinc-800/50 dark:text-zinc-300/50 border-b border-zinc-600/20 dark:border-zinc-500/20'> | ||
<td className='p-2'>Name</td> | ||
<td className='text-center p-2'>Qty</td> | ||
<td className='text-right p-2'>Amount</td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr className='border-b border-zinc-600/20 dark:border-zinc-500/20'> | ||
<td className='p-2'>Something Uniques 2</td> | ||
<td className='text-center p-2'>1</td> | ||
<td className='text-right p-2'>{formatAmount(829)}</td> | ||
</tr> | ||
<tr> | ||
<td className='p-2'>Something Uniques</td> | ||
<td className='text-center p-2'>3</td> | ||
<td className='text-right p-2'>{formatAmount(7231)}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
<div className='w-full flex justify-end'> | ||
<div className='w-2/6 text-sm'> | ||
<div className='w-full flex justify-between items-center mb-1'> | ||
<span className='text-zinc-800/60 dark:text-zinc-200/60'> | ||
Total Amount | ||
</span> | ||
<span>{formatAmount(5273)}</span> | ||
</div> | ||
<div className='flex w-full justify-between relative mb-1'> | ||
<span className='absolute -left-4 top-1/2 -translate-y-1/2 leading-3 font-bold'> | ||
+ | ||
</span> | ||
<span className='text-zinc-800/60 dark:text-zinc-200/60'> | ||
Tax | ||
</span> | ||
<span>₹ 16.00</span> | ||
</div> | ||
<div className='flex w-full justify-between relative mb-1'> | ||
<span className='absolute -left-4 top-1/2 -translate-y-1/2 leading-3 font-bold'> | ||
- | ||
</span> | ||
<span className='text-zinc-800/60 dark:text-zinc-200/60'> | ||
Discount | ||
</span> | ||
<span>₹ 18.00</span> | ||
</div> | ||
</div> | ||
</div> | ||
</CollapsibleContent> | ||
</Collapsible> | ||
) | ||
} | ||
|
||
export default CollapsiblePurchasedItems |
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,11 @@ | ||
"use client" | ||
|
||
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible" | ||
|
||
const Collapsible = CollapsiblePrimitive.Root | ||
|
||
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger | ||
|
||
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent | ||
|
||
export { Collapsible, CollapsibleTrigger, 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 |
---|---|---|
@@ -1,83 +1,93 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
darkMode: ["class"], | ||
darkMode: ['class'], | ||
content: [ | ||
"./pages/**/*.{ts,tsx}", | ||
"./components/**/*.{ts,tsx}", | ||
"./app/**/*.{ts,tsx}", | ||
"./src/**/*.{ts,tsx}", | ||
'./pages/**/*.{ts,tsx}', | ||
'./components/**/*.{ts,tsx}', | ||
'./app/**/*.{ts,tsx}', | ||
'./src/**/*.{ts,tsx}' | ||
], | ||
theme: { | ||
container: { | ||
center: true, | ||
padding: "2rem", | ||
padding: '2rem', | ||
screens: { | ||
"2xl": "1400px", | ||
}, | ||
'2xl': '1400px' | ||
} | ||
}, | ||
extend: { | ||
colors: { | ||
border: "hsl(var(--border))", | ||
input: "hsl(var(--input))", | ||
ring: "hsl(var(--ring))", | ||
background: "hsl(var(--background))", | ||
foreground: "hsl(var(--foreground))", | ||
border: 'hsl(var(--border))', | ||
input: 'hsl(var(--input))', | ||
ring: 'hsl(var(--ring))', | ||
background: 'hsl(var(--background))', | ||
foreground: 'hsl(var(--foreground))', | ||
primary: { | ||
DEFAULT: "hsl(var(--primary))", | ||
foreground: "hsl(var(--primary-foreground))", | ||
DEFAULT: 'hsl(var(--primary))', | ||
foreground: 'hsl(var(--primary-foreground))' | ||
}, | ||
secondary: { | ||
DEFAULT: "hsl(var(--secondary))", | ||
foreground: "hsl(var(--secondary-foreground))", | ||
DEFAULT: 'hsl(var(--secondary))', | ||
foreground: 'hsl(var(--secondary-foreground))' | ||
}, | ||
destructive: { | ||
DEFAULT: "hsl(var(--destructive))", | ||
foreground: "hsl(var(--destructive-foreground))", | ||
DEFAULT: 'hsl(var(--destructive))', | ||
foreground: 'hsl(var(--destructive-foreground))' | ||
}, | ||
muted: { | ||
DEFAULT: "hsl(var(--muted))", | ||
foreground: "hsl(var(--muted-foreground))", | ||
DEFAULT: 'hsl(var(--muted))', | ||
foreground: 'hsl(var(--muted-foreground))' | ||
}, | ||
accent: { | ||
DEFAULT: "hsl(var(--accent))", | ||
foreground: "hsl(var(--accent-foreground))", | ||
DEFAULT: 'hsl(var(--accent))', | ||
foreground: 'hsl(var(--accent-foreground))' | ||
}, | ||
popover: { | ||
DEFAULT: "hsl(var(--popover))", | ||
foreground: "hsl(var(--popover-foreground))", | ||
DEFAULT: 'hsl(var(--popover))', | ||
foreground: 'hsl(var(--popover-foreground))' | ||
}, | ||
card: { | ||
DEFAULT: "hsl(var(--card))", | ||
foreground: "hsl(var(--card-foreground))", | ||
}, | ||
DEFAULT: 'hsl(var(--card))', | ||
foreground: 'hsl(var(--card-foreground))' | ||
} | ||
}, | ||
borderRadius: { | ||
lg: "var(--radius)", | ||
md: "calc(var(--radius) - 2px)", | ||
sm: "calc(var(--radius) - 4px)", | ||
lg: 'var(--radius)', | ||
md: 'calc(var(--radius) - 2px)', | ||
sm: 'calc(var(--radius) - 4px)' | ||
}, | ||
keyframes: { | ||
"accordion-down": { | ||
'accordion-down': { | ||
from: { height: 0 }, | ||
to: { height: "var(--radix-accordion-content-height)" }, | ||
to: { height: 'var(--radix-accordion-content-height)' } | ||
}, | ||
"accordion-up": { | ||
from: { height: "var(--radix-accordion-content-height)" }, | ||
to: { height: 0 }, | ||
'accordion-up': { | ||
from: { height: 'var(--radix-accordion-content-height)' }, | ||
to: { height: 0 } | ||
}, | ||
'collapsible-down': { | ||
from: { height: 0 }, | ||
to: { height: 'var(--radix-collapsible-content-height)' } | ||
}, | ||
'collapsible-up': { | ||
from: { height: 'var(--radix-collapsible-content-height)' }, | ||
to: { height: 0 } | ||
} | ||
}, | ||
animation: { | ||
"accordion-down": "accordion-down 0.2s ease-out", | ||
"accordion-up": "accordion-up 0.2s ease-out", | ||
}, | ||
'accordion-down': 'accordion-down 0.2s ease-out', | ||
'accordion-up': 'accordion-up 0.2s ease-out', | ||
'collapsible-down': 'collapsible-down 0.2s ease-out', | ||
'collapsible-up': 'collapsible-up 0.2s ease-out' | ||
} | ||
}, | ||
darkMode: "class", | ||
darkMode: 'class', | ||
variants: { | ||
extend: { | ||
backgroundColor: ["dark"], | ||
textColor: ["dark"], | ||
}, | ||
}, | ||
backgroundColor: ['dark'], | ||
textColor: ['dark'] | ||
} | ||
} | ||
}, | ||
plugins: [require("tailwindcss-animate")], | ||
}; | ||
plugins: [require('tailwindcss-animate')] | ||
} |