-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28a5328
commit 37f05ff
Showing
4 changed files
with
225 additions
and
1 deletion.
There are no files selected for viewing
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,80 @@ | ||
import React from "react"; | ||
import * as Accordion from "@radix-ui/react-accordion"; | ||
import { ChevronDownIcon } from "@radix-ui/react-icons"; | ||
import "./styles.css"; | ||
import { cn } from '@/lib/utils' | ||
import { IconAgent, IconResult, IconSearch } from '@/components/ui/icons' | ||
|
||
export const AgentSteps = () => ( | ||
<Accordion.Root | ||
className="AccordionRoot" | ||
type="single" | ||
defaultValue="item-1" | ||
collapsible | ||
> | ||
<Accordion.Item className="AccordionItem" value="item-1"> | ||
<AccordionTrigger> | ||
<div className="AgentHeader"> | ||
<div className="AgentName">Tabby Agent</div> | ||
<div className="StepCounts">3-steps</div> | ||
</div> | ||
</AccordionTrigger> | ||
<AccordionContent> | ||
<div className="step"> | ||
<div className="step-title text-sm font-bold leading-none flex items-center"> | ||
<span className="inline-flex px-2"> | ||
<IconAgent /> | ||
</span> | ||
|
||
<span>Thinking</span></div> | ||
<div className="step-content p-2">task</div> | ||
</div> | ||
<div className="step"> | ||
<div className="step-title text-sm font-bold leading-none flex items-center"> | ||
<span className="inline-flex px-2"><IconResult /></span> | ||
Searching web</div> | ||
<div className="step-content p-2">task</div> | ||
</div> | ||
<div className="step"> | ||
<div className="step-title text-sm font-bold leading-none flex items-center"> | ||
<span className="inline-flex px-2"><IconSearch /></span> | ||
Combining results</div> | ||
<div className="step-content p-2">task</div> | ||
</div> | ||
</AccordionContent> | ||
</Accordion.Item> | ||
</Accordion.Root> | ||
); | ||
|
||
const AccordionTrigger = React.forwardRef< | ||
React.ElementRef<typeof Accordion.Trigger>, | ||
React.ComponentPropsWithoutRef<typeof Accordion.Trigger> | ||
>( | ||
({ children, className, ...props }, forwardedRef) => ( | ||
<Accordion.Header className="AccordionHeader"> | ||
<Accordion.Trigger | ||
className={cn("AccordionTrigger", className)} | ||
{...props} | ||
ref={forwardedRef} | ||
> | ||
{children} | ||
<ChevronDownIcon className="AccordionChevron" aria-hidden /> | ||
</Accordion.Trigger> | ||
</Accordion.Header> | ||
), | ||
); | ||
|
||
const AccordionContent = React.forwardRef< | ||
React.ElementRef<typeof Accordion.Content>, | ||
React.ComponentPropsWithoutRef<typeof Accordion.Content> | ||
>( | ||
({ children, className, ...props }, forwardedRef) => ( | ||
<Accordion.Content | ||
className={cn("AccordionContent", className)} | ||
{...props} | ||
ref={forwardedRef} | ||
> | ||
<div className="AccordionContentText">{children}</div> | ||
</Accordion.Content> | ||
), | ||
); |
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,117 @@ | ||
@import "@radix-ui/colors/black-alpha.css"; | ||
@import "@radix-ui/colors/mauve.css"; | ||
@import "@radix-ui/colors/violet.css"; | ||
|
||
/* reset */ | ||
button, | ||
h3 { | ||
all: unset; | ||
} | ||
|
||
.AccordionRoot { | ||
border-radius: 6px; | ||
width: 100%; | ||
background-color: var(--mauve-6); | ||
box-shadow: 0 2px 10px var(--black-a4); | ||
} | ||
|
||
.AccordionItem { | ||
overflow: hidden; | ||
margin-top: 1px; | ||
} | ||
|
||
.AccordionItem:first-child { | ||
margin-top: 0; | ||
border-top-left-radius: 4px; | ||
border-top-right-radius: 4px; | ||
} | ||
|
||
.AccordionItem:last-child { | ||
border-bottom-left-radius: 4px; | ||
border-bottom-right-radius: 4px; | ||
} | ||
|
||
.AccordionItem:focus-within { | ||
position: relative; | ||
z-index: 1; | ||
box-shadow: 0 0 0 2px var(--mauve-12); | ||
} | ||
|
||
.AccordionHeader { | ||
display: flex; | ||
} | ||
|
||
.step-title { | ||
color: black; | ||
} | ||
|
||
.AgentHeader { | ||
width: 100%; | ||
padding-right: 20px; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
.AccordionTrigger { | ||
font-family: inherit; | ||
background-color: transparent; | ||
padding: 0 20px; | ||
height: 45px; | ||
flex: 1; | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
font-size: 15px; | ||
line-height: 1; | ||
/* color: var(--violet-11); */ | ||
box-shadow: 0 1px 0 var(--mauve-6); | ||
background-color: white; | ||
} | ||
|
||
.AccordionTrigger:hover { | ||
background-color: var(--mauve-2); | ||
} | ||
|
||
.AccordionContent { | ||
overflow: hidden; | ||
font-size: 15px; | ||
color: var(--mauve-11); | ||
background-color: var(--mauve-2); | ||
} | ||
.AccordionContent[data-state="open"] { | ||
animation: slideDown 300ms cubic-bezier(0.87, 0, 0.13, 1); | ||
} | ||
.AccordionContent[data-state="closed"] { | ||
animation: slideUp 300ms cubic-bezier(0.87, 0, 0.13, 1); | ||
} | ||
|
||
.AccordionContentText { | ||
padding: 15px 20px; | ||
} | ||
|
||
.AccordionChevron { | ||
color: var(--violet-10); | ||
transition: transform 300ms cubic-bezier(0.87, 0, 0.13, 1); | ||
} | ||
.AccordionTrigger[data-state="open"] > .AccordionChevron { | ||
transform: rotate(180deg); | ||
} | ||
|
||
@keyframes slideDown { | ||
from { | ||
height: 0; | ||
} | ||
to { | ||
height: var(--radix-accordion-content-height); | ||
} | ||
} | ||
|
||
@keyframes slideUp { | ||
from { | ||
height: var(--radix-accordion-content-height); | ||
} | ||
to { | ||
height: 0; | ||
} | ||
} |
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