-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed: Accordion Color Issue. * Added: Component Converted into single color. * Renamed: WithKT into keepTheme. * Fixed: Import Issue Fixed. * Added: Modal and Drawer animation added. * Added: Notification animation added. * Updated: Notification & Navbar updated. * Added: Number Input Animation. * Added: Dropdown animation added. * Added: Popover animation added. * Added: Tooltip animation added. * Animation: Working with animation. * Animation: Animation add in component. * Added: Step animation added. * Added: CodePreview highlight added. * Updated: Keep blog and readme updated. * Removed: Metaldata utils fn deleted. * Fixed: Carousel and Dropdown Issue. * Added: Animation Smoothness added. * Update: Step point css moved to theme. * Updated: Update a new varient in the timeline and fixed animation in the stepline component * Fixed: Modal aschild props issue. * Added: Color and component updated. * Fixed: Step active issue. --------- Co-authored-by: moshiur01 <[email protected]>
- Loading branch information
1 parent
f8ea7ac
commit 6b85027
Showing
557 changed files
with
7,154 additions
and
7,626 deletions.
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,73 @@ | ||
'use client' | ||
import { Check, Copy } from 'phosphor-react' | ||
import { FC, useState } from 'react' | ||
import { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter' | ||
import { coldarkDark } from 'react-syntax-highlighter/dist/esm/styles/prism' | ||
import useCopy from '~/hooks/useCopy' | ||
import { Tooltip, TooltipAction, TooltipContent } from '../src' | ||
import { cn } from '../src/utils/cn' | ||
|
||
interface CodeHighlightProps { | ||
code: { | ||
[key: string]: string | ||
} | ||
} | ||
|
||
const CodeHighlight: FC<CodeHighlightProps> = ({ code }) => { | ||
const [codeType, setCodeType] = useState(0) | ||
const { copy, copyToClipboard } = useCopy() | ||
return ( | ||
<div className="my-5 w-full overflow-hidden rounded-xl border border-metal-900 bg-[#0D1015] dark:bg-[#0D1015]/90"> | ||
<div className="flex justify-between"> | ||
<div className="flex text-white"> | ||
{Object.keys(code).map((key, index) => ( | ||
<button | ||
key={key} | ||
onClick={() => setCodeType(index)} | ||
className={cn( | ||
'border-b border-r border-metal-800 px-6 py-2.5 text-body-4 font-normal', | ||
codeType === index ? 'bg-metal-900/10' : 'bg-metal-900', | ||
)}> | ||
<span>{key}</span> | ||
</button> | ||
))} | ||
</div> | ||
<div> | ||
<Tooltip placement="top"> | ||
<TooltipAction asChild> | ||
<button onClick={() => copyToClipboard(Object.values(code)[codeType])} className="mx-6 my-2.5"> | ||
{copy ? ( | ||
<Check size={20} weight="light" color="#fff" /> | ||
) : ( | ||
<Copy size={20} weight="light" color="#fff" /> | ||
)} | ||
</button> | ||
</TooltipAction> | ||
<TooltipContent> | ||
<p className="text-body-5 font-medium text-white dark:text-metal-900">{copy ? 'Copied' : 'Copy Code'}</p> | ||
</TooltipContent> | ||
</Tooltip> | ||
</div> | ||
</div> | ||
<div> | ||
<SyntaxHighlighter | ||
language="javascript" | ||
style={coldarkDark} | ||
customStyle={{ | ||
maxHeight: '420px', | ||
borderRadius: '0px', | ||
padding: '32px', | ||
marginTop: '0px', | ||
marginBottom: '0px', | ||
fontSize: '14px', | ||
lineHeight: '22px', | ||
letterSpacing: '-0.4px', | ||
}}> | ||
{Object.values(code)[codeType].trim()} | ||
</SyntaxHighlighter> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default CodeHighlight |
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,111 @@ | ||
'use client' | ||
import { Check, Copy } from 'phosphor-react' | ||
import { forwardRef, HTMLAttributes, useState } from 'react' | ||
import { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter' | ||
import { coldarkDark } from 'react-syntax-highlighter/dist/esm/styles/prism' | ||
import useCopy from '~/hooks/useCopy' | ||
import { Tooltip, TooltipAction, TooltipContent } from '../src' | ||
import { cn } from '../src/utils/cn' | ||
|
||
interface CodeHighlightPreviewProps extends HTMLAttributes<HTMLDivElement> { | ||
code: { | ||
[key: string]: string | ||
} | ||
activeTab?: number | ||
} | ||
|
||
const CodeHighlightPreview = forwardRef<HTMLDivElement, CodeHighlightPreviewProps>( | ||
({ children, code, className, activeTab }, ref) => { | ||
const [active, setActive] = useState(activeTab ?? 0) | ||
const { copy, copyToClipboard } = useCopy() | ||
|
||
return ( | ||
<div | ||
ref={ref} | ||
className={cn( | ||
'my-10 max-w-full overflow-hidden rounded-xl border border-metal-200 dark:border-metal-800 ', | ||
className, | ||
)}> | ||
<div className="flex items-center justify-between bg-[#0D1015] dark:bg-metal-900/60"> | ||
<div className="flex items-center"> | ||
<button | ||
type="button" | ||
onClick={() => setActive(0)} | ||
className={cn( | ||
'border-b border-b-transparent px-6 py-2.5 text-body-4 font-normal', | ||
active === 0 | ||
? 'border-b-metal-800 bg-metal-900/10 text-white dark:border-b-metal-200' | ||
: 'bg-metal-800 text-white opacity-50', | ||
)} | ||
id="preview-btn"> | ||
Preview | ||
</button> | ||
{Object.keys(code).map((key, index) => ( | ||
<button | ||
key={key} | ||
onClick={() => setActive(index + 1)} | ||
className={cn( | ||
'border-b border-b-transparent px-6 py-2.5 text-body-4 font-normal', | ||
active === index + 1 | ||
? 'border-b-metal-200 bg-metal-900/10 text-white' | ||
: 'bg-metal-900 text-white opacity-70', | ||
)}> | ||
<span>{key}</span> | ||
</button> | ||
))} | ||
</div> | ||
<div> | ||
<Tooltip placement="top"> | ||
<TooltipAction asChild> | ||
<button | ||
onClick={() => copyToClipboard(Object.values(code)[active === 0 ? 0 : active - 1])} | ||
className="mx-6 my-2.5"> | ||
{copy ? ( | ||
<Check size={20} weight="light" color="#fff" /> | ||
) : ( | ||
<Copy size={20} weight="light" color="#fff" /> | ||
)} | ||
</button> | ||
</TooltipAction> | ||
<TooltipContent> | ||
<p className="text-body-5 font-medium text-white dark:text-metal-900"> | ||
{copy ? 'Copied' : 'Copy Code'} | ||
</p> | ||
</TooltipContent> | ||
</Tooltip> | ||
</div> | ||
</div> | ||
|
||
{active !== 0 && ( | ||
<div> | ||
<SyntaxHighlighter | ||
language="javascript" | ||
style={coldarkDark} | ||
customStyle={{ | ||
maxHeight: '420px', | ||
borderRadius: '0px', | ||
padding: '32px', | ||
marginTop: '0px', | ||
marginBottom: '0px', | ||
fontSize: '14px', | ||
lineHeight: '22px', | ||
letterSpacing: '-0.4px', | ||
}}> | ||
{Object.values(code)[active - 1].trim()} | ||
</SyntaxHighlighter> | ||
</div> | ||
)} | ||
|
||
{active === 0 && ( | ||
<div className={cn('bg-white px-2 py-3 md:p-6 dark:bg-[#0D1015]', className)}> | ||
<div className="h-full w-full overflow-auto">{children}</div> | ||
</div> | ||
)} | ||
</div> | ||
) | ||
}, | ||
) | ||
|
||
CodeHighlightPreview.displayName = 'CodeHighlightPreview' | ||
|
||
export default CodeHighlightPreview |
This file was deleted.
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
Oops, something went wrong.