Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/noble components improve v2 #192

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
"mitosis:react": "rm -rf packages/react/src && node ./compiler/frameworks/react.compile.js",
"mitosis:vue": "rm -rf packages/vue/src && node ./compiler/frameworks/vue.compile.js",
"c:react": "node ./compiler -p react",
"b:react": "lerna run --stream --scope=@interchain-ui/react build",
"b:react": "pnpm run --stream --filter '@interchain-ui/react' build",
"c:vue": "pnpm run mitosis:vue && pnpm run b:vue",
"b:vue": "lerna run --stream --scope=@interchain-ui/vue build",
"b:vue": "pnpm run --stream --filter '@interchain-ui/vue' build",
"dev": "node ./compiler/dev",
"start": "cross-env NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006 --no-manager-cache",
"story:react": "lerna run --scope @interchain-ui/react-example --stream dev",
"story:react": "pnpm run --stream --filter '@interchain-ui/react' storybook",
"lerna": "lerna run",
"pub:beta": "lerna publish --no-private --preid beta",
"prepublishOnly": "pnpm run clear:cache && pnpm run c:react",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/scaffolds/popover/popover.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ export type UseInteractionsValue = ReturnType<typeof useInteractions>;
export type UseFloatingValue = ReturnType<typeof useFloating>;

export type UsePopoverReturnValue = PopoverOptions & {
arrowRef: React.RefObject<SVGSVGElement>;
arrowRef?: React.RefObject<SVGSVGElement>;
} & UseFloatingValue &
UseInteractionsValue;
8 changes: 8 additions & 0 deletions packages/react/stories/noble/NobleBaseComponents.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ export const Primary: Story = {
subLogoUrl={OSMO_LOGO_URL}
subLogoAlt="USDC"
/>

<NobleTokenAvatar
isLoadingSubLogo
mainLogoUrl={USDC_LOGO_URL}
mainLogoAlt="USDC"
subLogoUrl={OSMO_LOGO_URL}
subLogoAlt="USDC"
/>
</Box>

<Box display="flex" gap="$4" flexDirection="column" maxWidth="466px">
Expand Down
53 changes: 36 additions & 17 deletions src/ui/noble/noble-token-avatar.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
useRef,
onMount,
onUnMount,
Show,
useDefaultProps,
} from "@builder.io/mitosis";

Expand Down Expand Up @@ -60,23 +61,41 @@ export default function NobleTokenAvatar(props: NobleTokenAvatarProps) {
}}
/>

<Box
as="img"
width="$9"
height="$9"
position="absolute"
bottom="-4px"
right="-2px"
borderRadius="$full"
borderWidth="2px"
borderStyle="solid"
borderColor="$cardBg"
bg="$cardBg"
attributes={{
src: props.subLogoUrl,
alt: props.subLogoAlt ?? "Token logo",
}}
/>
<Show
when={props.isLoadingSubLogo}
else={
<Box
as="img"
width="$9"
height="$9"
position="absolute"
bottom="-4px"
right="-2px"
borderRadius="$full"
borderWidth="2px"
borderStyle="solid"
borderColor="$cardBg"
bg="$cardBg"
attributes={{
src: props.subLogoUrl,
alt: props.subLogoAlt ?? "Token logo",
}}
/>
}
>
<Box
width="$9"
height="$9"
position="absolute"
bottom="-4px"
right="-2px"
borderRadius="$full"
borderWidth="2px"
borderStyle="solid"
borderColor="$cardBg"
bg={state.theme === "light" ? "$gray800" : "$blue500"}
/>
</Show>
</Box>
);
}
1 change: 1 addition & 0 deletions src/ui/noble/noble.types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export interface NobleTokenAvatarProps {
subLogoUrl: string;
subLogoAlt?: string;
isRound?: boolean;
isLoadingSubLogo?: boolean;
}

type DisplayToken = {
Expand Down
Loading