Skip to content

Commit

Permalink
feat: finalized UI for poap plugin, missing final decision for api ke…
Browse files Browse the repository at this point in the history
…y handling
  • Loading branch information
anthony23991 committed Nov 18, 2024
1 parent 269be5a commit 271d14a
Show file tree
Hide file tree
Showing 7 changed files with 212 additions and 24 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@radix-ui/react-radio-group": "^1.2.1",
"@radix-ui/react-switch": "^1.1.1",
"@radix-ui/react-tabs": "^1.1.1",
"@radix-ui/react-tooltip": "^1.1.4",
"@rainbow-me/rainbowkit": "^2.0.2",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,50 @@
import { P, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@justweb3/ui';
import React from 'react';
import { POAP } from '../../hooks';

interface POAPCardProps {
poap: POAP;
poap: POAP;
}

const POAPCard: React.FC<POAPCardProps> = ({ poap }) => {
return (
<a href={`https://collectors.poap.xyz/token/${poap.event.id}`} target="_blank" rel="noopener noreferrer">
return (
<a href={`https://collectors.poap.xyz/token/${poap.event.id}`} target="_blank" rel="noopener noreferrer">
<TooltipProvider delayDuration={100}>
<Tooltip>
<TooltipTrigger asChild>
<img
src={poap.event.image_url}
alt={poap.event.name}
width={60}
height={60}
style={{
background: `url(${poap.event.image_url})`,
outline: '4px solid var(--justweb3-foreground-color-4)',
borderRadius: '50%',
boxShadow: '0px 0px 10px 0px var(--justweb3-foreground-color-2)',
cursor: 'pointer'
}}
src={poap.event.image_url}
alt={poap.event.name}
width={60}
height={60}
style={{
background: `url(${poap.event.image_url})`,
outline: '4px solid var(--justweb3-foreground-color-4)',
borderRadius: '50%',
boxShadow: '0px 0px 10px 0px var(--justweb3-foreground-color-2)',
cursor: 'pointer'
}}
/>
</a>
</TooltipTrigger>
<TooltipContent style={{ zIndex: 9999 }}>
<P style={{
fontSize: '9px',
fontWeight: 900,
lineHeight: '150%',
color: 'inherit'
}}>#{poap.event.id}</P>
<P style={{
fontSize: '10px',
fontWeight: 400,
lineHeight: '150%',
color: 'inherit'
}}>{poap.event.name}</P>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</a>

);
);
};

export default POAPCard;
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const getPoaps = async (address: string) => {
{
headers: {
Accept: 'application/json',
// TODO: apikey
// TODO: handle api key functionality
'x-api-key': '',
},
}
Expand Down
88 changes: 88 additions & 0 deletions packages/@justweb3/ui/src/lib/ui/ToolTip/ToolTip.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
.tooltipContent {
z-index: 190;
overflow: hidden;
border-radius: 0.375rem;
background-color: var(--justweb3-primary-color);
padding: 4px;
font-size: 10px;
color: var(--justweb3-background-color);
animation: fadeInZoom 0.2s ease-in-out;
}

.tooltipContent[data-state='closed'] {
animation: fadeOutZoom 0.2s ease-in-out;
}

.tooltipContent[data-side='top'] {
animation: slideInFromBottom 0.2s ease-in-out;
}

.tooltipContent[data-side='bottom'] {
animation: slideInFromTop 0.2s ease-in-out;
}

.tooltipContent[data-side='left'] {
animation: slideInFromRight 0.2s ease-in-out;
}

.tooltipContent[data-side='right'] {
animation: slideInFromLeft 0.2s ease-in-out;
}

@keyframes fadeInZoom {
from {
opacity: 0;
transform: scale(0.95);
}
to {
opacity: 1;
transform: scale(1);
}
}

@keyframes fadeOutZoom {
from {
opacity: 1;
transform: scale(1);
}
to {
opacity: 0;
transform: scale(0.95);
}
}

@keyframes slideInFromTop {
from {
transform: translateY(-8px);
}
to {
transform: translateY(0);
}
}

@keyframes slideInFromBottom {
from {
transform: translateY(8px);
}
to {
transform: translateY(0);
}
}

@keyframes slideInFromLeft {
from {
transform: translateX(-8px);
}
to {
transform: translateX(0);
}
}

@keyframes slideInFromRight {
from {
transform: translateX(8px);
}
to {
transform: translateX(0);
}
}
27 changes: 27 additions & 0 deletions packages/@justweb3/ui/src/lib/ui/ToolTip/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import * as React from "react";
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
import styles from "./ToolTip.module.css";
import clsx from "clsx";

const TooltipProvider = TooltipPrimitive.Provider;

const Tooltip = TooltipPrimitive.Root;

const TooltipTrigger = TooltipPrimitive.Trigger;

const TooltipContent = React.forwardRef<
React.ElementRef<typeof TooltipPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
>(({ sideOffset = 4, className, ...props }, ref) => (
<TooltipPrimitive.Portal>
<TooltipPrimitive.Content
ref={ref}
sideOffset={sideOffset}
className={clsx(styles.tooltipContent, className)}
{...props}
/>
</TooltipPrimitive.Portal>
));
TooltipContent.displayName = TooltipPrimitive.Content.displayName;

export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
15 changes: 8 additions & 7 deletions packages/@justweb3/ui/src/lib/ui/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
export * from './Avatar';
export * from './Button';
export * from './Divider';
export * from './Input';
export * from './Badge';
export * from './Button';
export * from './Carousel';
export * from './Dialog';
export * from './Divider';
export * from './Dropdown';
export * from './Text';
export * from './Form';
export * from './Input';
export * from './LoadingSpinner';
export * from './Carousel';
export * from './OTPInput';
export * from './Popover';
export * from './Separator';
export * from './OTPInput';
export * from './Form';
export * from './Tabs';
export * from './Text';
export * from './ToolTip';
50 changes: 50 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7545,6 +7545,36 @@ __metadata:
languageName: node
linkType: hard

"@radix-ui/react-tooltip@npm:^1.1.4":
version: 1.1.4
resolution: "@radix-ui/react-tooltip@npm:1.1.4"
dependencies:
"@radix-ui/primitive": "npm:1.1.0"
"@radix-ui/react-compose-refs": "npm:1.1.0"
"@radix-ui/react-context": "npm:1.1.1"
"@radix-ui/react-dismissable-layer": "npm:1.1.1"
"@radix-ui/react-id": "npm:1.1.0"
"@radix-ui/react-popper": "npm:1.2.0"
"@radix-ui/react-portal": "npm:1.1.2"
"@radix-ui/react-presence": "npm:1.1.1"
"@radix-ui/react-primitive": "npm:2.0.0"
"@radix-ui/react-slot": "npm:1.1.0"
"@radix-ui/react-use-controllable-state": "npm:1.1.0"
"@radix-ui/react-visually-hidden": "npm:1.1.0"
peerDependencies:
"@types/react": "*"
"@types/react-dom": "*"
react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
peerDependenciesMeta:
"@types/react":
optional: true
"@types/react-dom":
optional: true
checksum: 10c0/721cfb0bf34e74af5a58d89a73e087522517b9502fb7ae9d1dc99137d4952f2bfd1696001e17aa83dfb533c39b4333030149562ebfe62d31238a1a2995bc6bd6
languageName: node
linkType: hard

"@radix-ui/react-use-callback-ref@npm:1.1.0":
version: 1.1.0
resolution: "@radix-ui/react-use-callback-ref@npm:1.1.0"
Expand Down Expand Up @@ -7644,6 +7674,25 @@ __metadata:
languageName: node
linkType: hard

"@radix-ui/react-visually-hidden@npm:1.1.0":
version: 1.1.0
resolution: "@radix-ui/react-visually-hidden@npm:1.1.0"
dependencies:
"@radix-ui/react-primitive": "npm:2.0.0"
peerDependencies:
"@types/react": "*"
"@types/react-dom": "*"
react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
peerDependenciesMeta:
"@types/react":
optional: true
"@types/react-dom":
optional: true
checksum: 10c0/db138dd5f3c94958a9f836740d4408c89c4a73e770eaba5ead921e69b3c0d196c5cd58323d82829a9bc05a74873c299195dfd8366b9808e53a9a3dbca5a1e5fe
languageName: node
linkType: hard

"@radix-ui/rect@npm:1.1.0":
version: 1.1.0
resolution: "@radix-ui/rect@npm:1.1.0"
Expand Down Expand Up @@ -26186,6 +26235,7 @@ __metadata:
"@radix-ui/react-radio-group": "npm:^1.2.1"
"@radix-ui/react-switch": "npm:^1.1.1"
"@radix-ui/react-tabs": "npm:^1.1.1"
"@radix-ui/react-tooltip": "npm:^1.1.4"
"@rainbow-me/rainbowkit": "npm:^2.0.2"
"@rollup/plugin-commonjs": "npm:^25.0.7"
"@rollup/plugin-json": "npm:^6.1.0"
Expand Down

0 comments on commit 271d14a

Please sign in to comment.