Skip to content

Commit

Permalink
feature(packages/ui): Lint and clean up ui package (#15267)
Browse files Browse the repository at this point in the history
* update Button

* update Address and AddressInput

* remove formatPrice

* update PriceFormatter

* update package.json
  • Loading branch information
0xTxbi authored Dec 12, 2024
1 parent e754e99 commit bbbbfd6
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 96 deletions.
2 changes: 1 addition & 1 deletion packages/ui/lib/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactNode, ForwardedRef } from 'react'
import type { SizeStyleProp, Size } from '../../types'
import type { SizeStyleProp } from '../../types'
import { twMerge } from 'tailwind-merge'
import { forwardRef } from 'react'
import { Box, Props as BoxProps } from '../Box/Box'
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/lib/components/Display/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Address: React.FC<AddressProps> = ({
onCopied,
}) => {
// manage clipboard copy status
const [isCopied, setCopied] = useClipboard(address, {
const [, setCopied] = useClipboard(address, {
successDuration: 0,
})
//state to hold the resolved name, initialized with the resolvedName prop
Expand Down
28 changes: 8 additions & 20 deletions packages/ui/lib/components/Form/AddressInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface Props extends InputProps {
withIcon?: boolean
isTruncated?: boolean
onResolveName: (address: string) => Promise<any>
ref?: ForwardedRef<HTMLInputElement>
}

const WalletIcon = (props: IconBaseProps) => (
Expand All @@ -58,6 +59,7 @@ export const WrappedAddressInput = ({
onChange,
onResolveName,
error,
ref,
...inputProps
}: Props) => {
const [errorMessage, setErrorMessage] = useState<string>('')
Expand Down Expand Up @@ -146,6 +148,7 @@ export const WrappedAddressInput = ({
description={description}
iconClass={resolveNameMutation.isPending ? 'animate-spin' : ''}
icon={resolveNameMutation.isPending ? LoadingIcon : WalletIcon}
ref={ref}
onChange={(e) => {
const value: string = e.target.value
resolveNameMutation.reset() // Reset the mutation to handle new input values.
Expand All @@ -168,26 +171,11 @@ export const WrappedAddressInput = ({
*
*/
export const AddressInput = forwardRef(
(props: Props, ref: ForwardedRef<HTMLInputElement>) => {
const {
size = 'medium',
value,
defaultValue,
className,
description,
label,
withIcon = true,
isTruncated = false, // address not truncated by default
onChange,
onResolveName,
...inputProps
} = props
return (
<QueryClientProvider client={queryClient}>
<WrappedAddressInput {...props} />
</QueryClientProvider>
)
}
(props: Props, ref: ForwardedRef<HTMLInputElement>) => (
<QueryClientProvider client={queryClient}>
<WrappedAddressInput {...props} ref={ref} />
</QueryClientProvider>
)
)

AddressInput.displayName = 'AddressInput'
2 changes: 0 additions & 2 deletions packages/ui/lib/components/PriceFormatter/PriceFormatter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

export interface PriceFormatterProps {
price: string
precision?: number
Expand Down
59 changes: 0 additions & 59 deletions packages/ui/lib/components/PriceFormatter/formatPrice.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@
"@radix-ui/react-tooltip": "1.1.4",
"@tailwindcss/aspect-ratio": "0.4.2",
"@tailwindcss/forms": "0.5.9",
"@tailwindcss/line-clamp": "0.4.4",
"@tailwindcss/typography": "0.5.15",
"@tanstack/react-query": "5.62.0",
"@tw-classed/react": "1.7.0",
"@unlock-protocol/networks": "workspace:./packages/networks",
"ethers": "6.13.4",
"prism-react-renderer": "2.4.0",
"react-dropzone": "14.3.5",
Expand Down
11 changes: 0 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15988,15 +15988,6 @@ __metadata:
languageName: node
linkType: hard

"@tailwindcss/line-clamp@npm:0.4.4":
version: 0.4.4
resolution: "@tailwindcss/line-clamp@npm:0.4.4"
peerDependencies:
tailwindcss: ">=2.0.0 || >=3.0.0 || >=3.0.0-alpha.1"
checksum: 10/3d2ad992aa9263fe9b5cdb23bcfca521a6ab00f65e0f7167be35d2cb46b1635af72889ff9f6d5b2febf5aa5a36e3128eaad8ed43e43af4512c74c74f1058c4c0
languageName: node
linkType: hard

"@tailwindcss/typography@npm:0.5.15":
version: 0.5.15
resolution: "@tailwindcss/typography@npm:0.5.15"
Expand Down Expand Up @@ -18366,13 +18357,11 @@ __metadata:
"@storybook/react-vite": "npm:8.4.6"
"@tailwindcss/aspect-ratio": "npm:0.4.2"
"@tailwindcss/forms": "npm:0.5.9"
"@tailwindcss/line-clamp": "npm:0.4.4"
"@tailwindcss/typography": "npm:0.5.15"
"@tanstack/react-query": "npm:5.62.0"
"@tw-classed/react": "npm:1.7.0"
"@types/react": "npm:18.3.12"
"@types/react-dom": "npm:18.3.1"
"@unlock-protocol/networks": "workspace:./packages/networks"
"@unlock-protocol/unlock-js": "workspace:./packages/unlock-js"
"@vitejs/plugin-react": "npm:4.3.4"
autoprefixer: "npm:10.4.20"
Expand Down

0 comments on commit bbbbfd6

Please sign in to comment.