Skip to content

Commit

Permalink
UPDATED: Keep React Version 1.5.0.
Browse files Browse the repository at this point in the history
* 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
Arifulislam5577 and moshiur01 authored Aug 16, 2024
1 parent f8ea7ac commit 6b85027
Show file tree
Hide file tree
Showing 557 changed files with 7,154 additions and 7,626 deletions.
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ pnpm add keep-react phosphor-react
following code:

```jsx
import keepPreset from 'keep-react/preset'
export default {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}', 'node_modules/keep-react/**/*.{js,jsx,ts,tsx}'],
presets: [keepPreset],
import { keepTheme } from 'keep-react/keepTheme'

const config = {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
theme: {},
}

export default keepTheme(config)
```

`Step 5:` Add Tailwind CSS to index.css File:
Expand Down Expand Up @@ -111,13 +114,14 @@ pnpm add keep-react phosphor-react
following code

```js
module.exports = {
content: [
// ... (existing content)
'./node_modules/keep-react/**/*.{js,jsx,ts,tsx}',
],
presets: [require('keep-react/preset')],
import { keepTheme } from 'keep-react/keepTheme'

const config = {
content: ['./components/**/*.{js,ts,jsx,tsx,mdx}', './app/**/*.{js,ts,jsx,tsx,mdx}'],
theme: {},
}

export default keepTheme(config)
```

`Step 4:` Add Tailwind CSS to `globals.css` File:
Expand All @@ -134,7 +138,6 @@ Congratulations! You have successfully installed the Keep React. Now you can imp
## usage

```jsx
'use client'
import { Button } from 'keep-react'
const App = () => {
return <Button>Button</Button>
Expand Down
73 changes: 73 additions & 0 deletions app/components/CodeHighlight.tsx
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
111 changes: 111 additions & 0 deletions app/components/CodeHighlightPreview.tsx
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
103 changes: 0 additions & 103 deletions app/components/CodePreview.tsx

This file was deleted.

16 changes: 6 additions & 10 deletions app/components/Community.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Link from 'next/link'
import { ArrowLineUpRight } from 'phosphor-react'
import { useEffect, useState } from 'react'
import { Avatar, AvatarGroup } from '../src'
import { Avatar, AvatarGroup, AvatarImage } from '../src'

interface Contributor {
login: string
Expand Down Expand Up @@ -36,10 +36,10 @@ const Community = () => {
<section className="community py-20">
<div className="mx-auto max-w-7xl px-6 py-6 2xl:px-0">
<div className="mb-12 text-center">
<h4 className="mb-1 text-body-1 !font-semibold text-black dark:text-white lg:text-heading-5">
<h4 className="mb-1 text-body-1 !font-semibold text-black lg:text-heading-5 dark:text-white">
Join The Community
</h4>
<p className="mx-auto max-w-sm text-body-4 font-normal text-metal-600 dark:text-metal-300 md:text-body-3">
<p className="mx-auto max-w-sm text-body-4 font-normal text-metal-600 md:text-body-3 dark:text-metal-300">
Become a member of a community of developers by supporting Keep React
</p>
</div>
Expand All @@ -51,13 +51,9 @@ const Community = () => {
{contributors?.length ? (
<AvatarGroup>
{contributors?.map((user) => (
<Avatar
key={user?.id}
shape="circle"
size="lg"
img={user?.avatar_url}
className="border-2 border-[#9686E5] p-0"
/>
<Avatar key={user?.id} className="size-14">
<AvatarImage src={user?.avatar_url} />
</Avatar>
))}
</AvatarGroup>
) : null}
Expand Down
2 changes: 1 addition & 1 deletion app/components/ComponentApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const spaceMono = Space_Mono({ subsets: ['latin'], weight: ['400'] })
const ComponentApi: FC<ComponentProps> = ({ data }) => {
return (
<div className={spaceMono.className + 'mx-auto w-full overflow-auto'}>
<table className="whitespace-no-wrap z-50 mt-10 min-w-max table-auto overflow-hidden rounded-xl bg-white text-left dark:bg-metal-900 md:w-full lg:min-w-min">
<table className="whitespace-no-wrap z-50 mt-10 min-w-max table-auto overflow-hidden rounded-xl bg-white text-left md:w-full lg:min-w-min dark:bg-metal-900">
<thead>
<tr>
<th className="rounded-bl rounded-tl bg-metal-50 px-4 py-3 text-body-4 font-medium text-metal-900 dark:bg-white dark:text-metal-900">
Expand Down
Loading

0 comments on commit 6b85027

Please sign in to comment.