Skip to content

Commit

Permalink
refactor it's user
Browse files Browse the repository at this point in the history
  • Loading branch information
KhudaDad414 committed Jun 3, 2024
1 parent 7cadab6 commit 97fc2e4
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 18 deletions.
36 changes: 28 additions & 8 deletions apps/design-system/src/styles/tailwind.output.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
! tailwindcss v3.3.3 | MIT License | https://tailwindcss.com
! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com
*/

/*
Expand Down Expand Up @@ -32,9 +32,11 @@
4. Use the user's configured `sans` font-family by default.
5. Use the user's configured `sans` font-feature-settings by default.
6. Use the user's configured `sans` font-variation-settings by default.
7. Disable tap highlights on iOS
*/

html {
html,
:host {
line-height: 1.5;
/* 1 */
-webkit-text-size-adjust: 100%;
Expand All @@ -48,6 +50,8 @@ html {
/* 5 */
font-variation-settings: normal;
/* 6 */
-webkit-tap-highlight-color: transparent;
/* 7 */
}

/*
Expand Down Expand Up @@ -119,8 +123,10 @@ strong {
}

/*
1. Use the user's configured `mono` font family by default.
2. Correct the odd `em` font sizing in all browsers.
1. Use the user's configured `mono` font-family by default.
2. Use the user's configured `mono` font-feature-settings by default.
3. Use the user's configured `mono` font-variation-settings by default.
4. Correct the odd `em` font sizing in all browsers.
*/

code,
Expand All @@ -129,8 +135,12 @@ samp,
pre {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
/* 1 */
font-size: 1em;
font-feature-settings: normal;
/* 2 */
font-variation-settings: normal;
/* 3 */
font-size: 1em;
/* 4 */
}

/*
Expand Down Expand Up @@ -199,6 +209,8 @@ textarea {
/* 1 */
line-height: inherit;
/* 1 */
letter-spacing: inherit;
/* 1 */
color: inherit;
/* 1 */
margin: 0;
Expand All @@ -222,9 +234,9 @@ select {
*/

button,
[type='button'],
[type='reset'],
[type='submit'] {
input:where([type='button']),
input:where([type='reset']),
input:where([type='submit']) {
-webkit-appearance: button;
/* 1 */
background-color: transparent;
Expand Down Expand Up @@ -473,6 +485,10 @@ video {
--tw-backdrop-opacity: ;
--tw-backdrop-saturate: ;
--tw-backdrop-sepia: ;
--tw-contain-size: ;
--tw-contain-layout: ;
--tw-contain-paint: ;
--tw-contain-style: ;
}

::backdrop {
Expand Down Expand Up @@ -523,6 +539,10 @@ video {
--tw-backdrop-opacity: ;
--tw-backdrop-saturate: ;
--tw-backdrop-sepia: ;
--tw-contain-size: ;
--tw-contain-layout: ;
--tw-contain-paint: ;
--tw-contain-style: ;
}

.m-3 {
Expand Down
33 changes: 23 additions & 10 deletions packages/ui/components/Toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Tooltip from './Tooltip'
import * as RadixToolbar from '@radix-ui/react-toolbar'
import { FunctionComponent } from 'react'
import { DropdownMenu, DropdownMenuItem } from './DropdownMenu'
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from './DropdownMenu'

interface ToolbarToggleItem {
type: 'toggle'
Expand Down Expand Up @@ -31,10 +31,21 @@ interface ToolbarSeparatorItem {
type: 'separator'
}

interface DropdownMenuRegularItem {
type?: 'regular'
title: string
onSelect: () => void
}

interface DropdownMenuSeparatorItem {
type: 'separator'
}

type DropdownMenuItemInterface = DropdownMenuRegularItem | DropdownMenuSeparatorItem
interface ToolbarDropdownMenuItem {
type: 'dropdownMenu',
icon: FunctionComponent<any>
items: DropdownMenuItem[]
items: DropdownMenuItemInterface[]
}

type ToolbarItem = ToolbarToggleItem | ToolbarToggleGroupSingleItem | ToolbarToggleGroupMultipleItem | ToolbarSeparatorItem | ToolbarDropdownMenuItem
Expand Down Expand Up @@ -117,17 +128,19 @@ const ToolbarItem: FunctionComponent<ToolbarItemProps> = ({ item }) => {
)
} else if (type === 'dropdownMenu') {
return (
<DropdownMenu
trigger={
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button className="flex text-sm focus:outline-none border-box py-2 my-3.5 text-gray-500 hover:text-white focus:text-white rounded">
<item.icon className="w-6 h-6"/>
</button>
}
items={item.items}
side="bottom"
align="end"
/>

</DropdownMenuTrigger>
<DropdownMenuContent>
{item.items.map((menuItem) => (
menuItem.type === 'separator' ? <DropdownMenuSeparator key={menuItem.type} /> :
<DropdownMenuItem key={menuItem.title} onSelect={menuItem.onSelect}>{menuItem.title}</DropdownMenuItem>
))}
</DropdownMenuContent>
</DropdownMenu>
)
}
throw new Error(`Unsupported type of Toolbar item: ${type}`)
Expand Down
1 change: 1 addition & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"eslint-config-custom": "workspace:*",
"postcss": "^8.4.31",
"tailwind-config": "workspace:*",
"@asyncapi/studio-utils": "workspace:*",
"tsconfig": "workspace:*",
"tsup": "^8.0.2",
"typescript": "^4.9.4"
Expand Down

0 comments on commit 97fc2e4

Please sign in to comment.