Skip to content

Commit

Permalink
fix: mobile buttons in console
Browse files Browse the repository at this point in the history
  • Loading branch information
HadiKhai committed Dec 11, 2024
1 parent 8670607 commit daae6e0
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 117 deletions.
9 changes: 6 additions & 3 deletions apps/console/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default function Page() {
<div className="mobile:hidden">
<SectionSlider
trigger={
<div className="py-[7px] px-2.5 bg-[#3280F4] font-xs font-black text-white border border-black rounded-[8px_8px_0px_0px] rotate-90">
Customise
<div className="py-[7px] px-2.5 bg-[#3280F4] font-xs font-black text-white border border-black rounded-[8px_8px_0px_0px]">
Customize
</div>
}
side="left"
Expand All @@ -40,10 +40,13 @@ export default function Page() {
maxWidth: `${leftWidth}%`,
}}
>
<h1 className={'text-xl font-black'}>Live Demo</h1>
<JustWeb3Button>
<ConnectButton />
</JustWeb3Button>

<h1 className={'text-xl font-black'}>Profile Examples:</h1>

<JustEnsCard addressOrEns={'justhadi.eth'} />
<JustEnsCard addressOrEns={'justghadi.eth'} />
<JustEnsCard addressOrEns={'mely.eth'} />
Expand Down Expand Up @@ -71,7 +74,7 @@ export default function Page() {
<div className="mobile:hidden overflow-hidden w-full">
<SectionSlider
trigger={
<div className="py-[7px] px-2.5 bg-[#FEA801] font-xs font-black text-white border border-black rounded-[8px_8px_0px_0px] translate-y-[10px] -rotate-90">
<div className="py-[7px] px-2.5 bg-[#FEA801] font-xs font-black text-white border border-black rounded-[8px_8px_0px_0px] ">
Code Output
</div>
}
Expand Down
99 changes: 69 additions & 30 deletions apps/console/src/components/reusable/SectionSlider/index.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,74 @@
import { Drawer, DrawerClose, DrawerContent, DrawerHeader, DrawerTitle, DrawerTrigger } from "../../ui/drawer";
import {
Drawer,
DrawerClose,
DrawerContent,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from '../../ui/drawer';

interface SectionSliderProps {
side: 'left' | 'right';
children: React.ReactNode;
title: string;
trigger: React.ReactNode;
side: 'left' | 'right';
children: React.ReactNode;
title: string;
trigger: React.ReactNode;
}

export const SectionSlider = ({ side, children, title, trigger }: SectionSliderProps) => {
return (

<Drawer direction={side} >
<DrawerTrigger className={`absolute z-[120] top-16 ${side === 'left' ? 'left-[-33px]' : 'right-[-42px]'}`}>
{trigger}
</DrawerTrigger>
<DrawerContent disableOverlay>
<DrawerHeader className="flex flex-row gap-[5px] items-center">
<DrawerClose>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
<mask id="mask0_4168_2122" style={{ maskType: 'alpha' }} maskUnits="userSpaceOnUse" x="0" y="0" width="20" height="20">
<rect width="20" height="20" transform="matrix(-1 0 0 1 20 0)" fill="#D9D9D9" />
</mask>
<g mask="url(#mask0_4168_2122)">
<path d="M13.3125 18.3333L14.7917 16.8542L7.93752 10L14.7917 3.14584L13.3125 1.66667L4.97919 10L13.3125 18.3333Z" fill="#3280F4" />
</g>
</svg>
</DrawerClose>
<DrawerTitle>{title}</DrawerTitle>
</DrawerHeader>
{children}
</DrawerContent>
</Drawer>
);
export const SectionSlider = ({
side,
children,
title,
trigger,
}: SectionSliderProps) => {
return (
<Drawer direction={side}>
<DrawerTrigger
className={`absolute z-[120] top-16 ${
side === 'left'
? 'left-[-33px] rotate-90'
: 'right-[-42px] -rotate-90'
}`}
>
{trigger}
</DrawerTrigger>
<DrawerContent disableOverlay>
<DrawerHeader className="flex flex-row gap-[5px] items-center">
<DrawerClose>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
>
<mask
id="mask0_4168_2122"
style={{ maskType: 'alpha' }}
maskUnits="userSpaceOnUse"
x="0"
y="0"
width="20"
height="20"
>
<rect
width="20"
height="20"
transform="matrix(-1 0 0 1 20 0)"
fill="#D9D9D9"
/>
</mask>
<g mask="url(#mask0_4168_2122)">
<path
d="M13.3125 18.3333L14.7917 16.8542L7.93752 10L14.7917 3.14584L13.3125 1.66667L4.97919 10L13.3125 18.3333Z"
fill="#3280F4"
/>
</g>
</svg>
</DrawerClose>
<DrawerTitle>{title}</DrawerTitle>
</DrawerHeader>
{children}
</DrawerContent>
</Drawer>
);
};
123 changes: 75 additions & 48 deletions apps/console/src/components/sections/customizer/ClaimSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,64 +108,91 @@ export const ClaimSection = () => {
}}
>
<p className="text-base text-black font-bold leading-[125%] my-[5px]">
Claim A Subname
Let User Claim a Subname From
</p>
<OptionSelect
label={chainId === 1 ? defaultMainnetValue : defaultTestnetValue}
value={chainId === 1 ? defaultMainnetValue : defaultTestnetValue}
showFree
/>
<div className="flex flex-col gap-2.5 p-2.5">
<p className="text-xs font-medium text-black">My ENS</p>
<Input
value={apiKey}
onChange={(e) => setApiKey(e.target.value)}
placeholder="Justaname API Key"
rightIcon={
<svg
xmlns="http://www.w3.org/2000/svg"
width="15"
height="16"
viewBox="0 0 15 16"
fill="none"
>
<g id="help">
<mask
id="mask0_1794_1160"
style={{
maskType: 'alpha',
}}
maskUnits="userSpaceOnUse"
x="0"
y="0"
width="15"
height="16"
>
<rect
id="Bounding box"
y="0.5"
<p className="text-xs font-medium text-black">
My ENS ([subname].[yourens].eth)
</p>
<div
className={
'p-5 border-dashed border-2 border-black rounded-[8px] flex flex-col gap-2.5'
}
>
<Input
value={apiKey}
onChange={(e) => setApiKey(e.target.value)}
placeholder="Justaname API Key"
rightIcon={
<svg
xmlns="http://www.w3.org/2000/svg"
width="15"
height="16"
viewBox="0 0 15 16"
fill="none"
>
<g id="help">
<mask
id="mask0_1794_1160"
style={{
maskType: 'alpha',
}}
maskUnits="userSpaceOnUse"
x="0"
y="0"
width="15"
height="15"
fill="#D9D9D9"
/>
</mask>
<g mask="url(#mask0_1794_1160)">
<path
id="help_2"
d="M7.46875 11.75C7.6875 11.75 7.8724 11.6745 8.02344 11.5234C8.17448 11.3724 8.25 11.1875 8.25 10.9688C8.25 10.75 8.17448 10.5651 8.02344 10.4141C7.8724 10.263 7.6875 10.1875 7.46875 10.1875C7.25 10.1875 7.0651 10.263 6.91406 10.4141C6.76302 10.5651 6.6875 10.75 6.6875 10.9688C6.6875 11.1875 6.76302 11.3724 6.91406 11.5234C7.0651 11.6745 7.25 11.75 7.46875 11.75ZM6.90625 9.34375H8.0625C8.0625 9 8.10156 8.72917 8.17969 8.53125C8.25781 8.33333 8.47917 8.0625 8.84375 7.71875C9.11458 7.44792 9.32812 7.1901 9.48438 6.94531C9.64062 6.70052 9.71875 6.40625 9.71875 6.0625C9.71875 5.47917 9.50521 5.03125 9.07813 4.71875C8.65104 4.40625 8.14583 4.25 7.5625 4.25C6.96875 4.25 6.48698 4.40625 6.11719 4.71875C5.7474 5.03125 5.48958 5.40625 5.34375 5.84375L6.375 6.25C6.42708 6.0625 6.54427 5.85938 6.72656 5.64062C6.90885 5.42188 7.1875 5.3125 7.5625 5.3125C7.89583 5.3125 8.14583 5.40365 8.3125 5.58594C8.47917 5.76823 8.5625 5.96875 8.5625 6.1875C8.5625 6.39583 8.5 6.59115 8.375 6.77344C8.25 6.95573 8.09375 7.125 7.90625 7.28125C7.44792 7.6875 7.16667 7.99479 7.0625 8.20312C6.95833 8.41146 6.90625 8.79167 6.90625 9.34375ZM7.5 14.25C6.63542 14.25 5.82292 14.0859 5.0625 13.7578C4.30208 13.4297 3.64062 12.9844 3.07812 12.4219C2.51562 11.8594 2.07031 11.1979 1.74219 10.4375C1.41406 9.67708 1.25 8.86458 1.25 8C1.25 7.13542 1.41406 6.32292 1.74219 5.5625C2.07031 4.80208 2.51562 4.14062 3.07812 3.57812C3.64062 3.01562 4.30208 2.57031 5.0625 2.24219C5.82292 1.91406 6.63542 1.75 7.5 1.75C8.36458 1.75 9.17708 1.91406 9.9375 2.24219C10.6979 2.57031 11.3594 3.01562 11.9219 3.57812C12.4844 4.14062 12.9297 4.80208 13.2578 5.5625C13.5859 6.32292 13.75 7.13542 13.75 8C13.75 8.86458 13.5859 9.67708 13.2578 10.4375C12.9297 11.1979 12.4844 11.8594 11.9219 12.4219C11.3594 12.9844 10.6979 13.4297 9.9375 13.7578C9.17708 14.0859 8.36458 14.25 7.5 14.25Z"
fill="var(--primary)"
/>
height="16"
>
<rect
id="Bounding box"
y="0.5"
width="15"
height="15"
fill="#D9D9D9"
/>
</mask>
<g mask="url(#mask0_1794_1160)">
<path
id="help_2"
d="M7.46875 11.75C7.6875 11.75 7.8724 11.6745 8.02344 11.5234C8.17448 11.3724 8.25 11.1875 8.25 10.9688C8.25 10.75 8.17448 10.5651 8.02344 10.4141C7.8724 10.263 7.6875 10.1875 7.46875 10.1875C7.25 10.1875 7.0651 10.263 6.91406 10.4141C6.76302 10.5651 6.6875 10.75 6.6875 10.9688C6.6875 11.1875 6.76302 11.3724 6.91406 11.5234C7.0651 11.6745 7.25 11.75 7.46875 11.75ZM6.90625 9.34375H8.0625C8.0625 9 8.10156 8.72917 8.17969 8.53125C8.25781 8.33333 8.47917 8.0625 8.84375 7.71875C9.11458 7.44792 9.32812 7.1901 9.48438 6.94531C9.64062 6.70052 9.71875 6.40625 9.71875 6.0625C9.71875 5.47917 9.50521 5.03125 9.07813 4.71875C8.65104 4.40625 8.14583 4.25 7.5625 4.25C6.96875 4.25 6.48698 4.40625 6.11719 4.71875C5.7474 5.03125 5.48958 5.40625 5.34375 5.84375L6.375 6.25C6.42708 6.0625 6.54427 5.85938 6.72656 5.64062C6.90885 5.42188 7.1875 5.3125 7.5625 5.3125C7.89583 5.3125 8.14583 5.40365 8.3125 5.58594C8.47917 5.76823 8.5625 5.96875 8.5625 6.1875C8.5625 6.39583 8.5 6.59115 8.375 6.77344C8.25 6.95573 8.09375 7.125 7.90625 7.28125C7.44792 7.6875 7.16667 7.99479 7.0625 8.20312C6.95833 8.41146 6.90625 8.79167 6.90625 9.34375ZM7.5 14.25C6.63542 14.25 5.82292 14.0859 5.0625 13.7578C4.30208 13.4297 3.64062 12.9844 3.07812 12.4219C2.51562 11.8594 2.07031 11.1979 1.74219 10.4375C1.41406 9.67708 1.25 8.86458 1.25 8C1.25 7.13542 1.41406 6.32292 1.74219 5.5625C2.07031 4.80208 2.51562 4.14062 3.07812 3.57812C3.64062 3.01562 4.30208 2.57031 5.0625 2.24219C5.82292 1.91406 6.63542 1.75 7.5 1.75C8.36458 1.75 9.17708 1.91406 9.9375 2.24219C10.6979 2.57031 11.3594 3.01562 11.9219 3.57812C12.4844 4.14062 12.9297 4.80208 13.2578 5.5625C13.5859 6.32292 13.75 7.13542 13.75 8C13.75 8.86458 13.5859 9.67708 13.2578 10.4375C12.9297 11.1979 12.4844 11.8594 11.9219 12.4219C11.3594 12.9844 10.6979 13.4297 9.9375 13.7578C9.17708 14.0859 8.36458 14.25 7.5 14.25Z"
fill="var(--primary)"
/>
</g>
</g>
</g>
</svg>
}
/>
</svg>
}
/>

{ensByApiKey
.filter((ens) => ens.chainId === chainId)
.map((ens) => (
<OptionSelect key={ens.ens} label={ens.ens} value={ens.ens} />
))}
<p className={'text-xs text-center'}>
Go to the{' '}
<a
href={'https://dashboard.justaname.id'}
target={'_blank'}
className={'text-primary'}
>
Dashboard
</a>{' '}
to generate API keys
</p>
{ensByApiKey
.filter((ens) => ens.chainId === chainId)
.map((ens, index) => (
<>
{index ===
ensByApiKey.filter((ens) => ens.chainId === chainId)
.length -
1 && (
<div className="w-full h-[1px] min-h-[1px] bg-[#CBD5E180]" />
)}
<OptionSelect key={ens.ens} label={ens.ens} value={ens.ens} />
</>
))}
</div>
</div>
</RadioGroup>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,37 @@ export const Customizer = ({ mobile }: CustomizerProps) => {
}, [logoUrlDebounced]);

return (
<div className={`flex flex-col gap-[5px] min-w-[350px] mobile:w-[350px] border-r-[1px] pointer-events-auto ${mobile ? 'pb-5' : 'py-5'} px-2.5 mobile:max-h-[calc(100vh-60px)] overflow-y-auto `}>
<div
className={`flex flex-col gap-[5px] min-w-[350px] mobile:w-[350px] border-r-[1px] pointer-events-auto ${
mobile ? 'pb-5' : 'py-5'
} px-2.5 mobile:max-h-[calc(100vh-60px)] overflow-y-auto `}
>
<div className="flex flex-col gap-2.5">
{!mobile && (
<div className="flex flex-row items-center justify-between w-full py-[5px]">
<p className="text-base text-black font-bold leading-[125%] my-[5px]">
Customize Interface
Select Network
</p>
)}
<div className="flex flex-row items-center gap-2.5">
<p className="text-sm text-black font-medium leading-[100%] whitespace-nowrap">
{chainId === 1 ? 'Mainnet' : 'Sepolia'}
</p>
<Switch
checked={chainId === 1}
onCheckedChange={() => {
switchChainAsync({
chainId: chainId === 1 ? 11155111 : 1,
});
}}
/>
</div>
</div>
<div className="w-full h-[1px] min-h-[1px] bg-[#CBD5E180]" />

{/*{!mobile && (*/}
<p className="text-base text-black font-bold leading-[125%] my-[5px]">
Customize Widget
</p>
{/*)}*/}
<div className="flex flex-row justify-between gap-2.5">
<ColorSelector
colors={['#FFFFFF', '#000000']}
Expand All @@ -46,7 +70,7 @@ export const Customizer = ({ mobile }: CustomizerProps) => {
}}
/>
<ColorSelector
colors={['#FEA801', '#C90018']}
colors={['#FEA801', '#C90018', '#3481f4']}
title="Accent Color"
onColorChange={(color: string) => {
changeTheme('primary', color);
Expand All @@ -73,25 +97,6 @@ export const Customizer = ({ mobile }: CustomizerProps) => {

<div className="w-full h-[1px] min-h-[1px] bg-[#CBD5E180]" />

<div className="flex flex-row items-center justify-between w-full py-[5px]">
<p className="text-base text-black font-bold leading-[125%] my-[5px]">
Network
</p>
<div className="flex flex-row items-center gap-2.5">
<p className="text-sm text-black font-medium leading-[100%] whitespace-nowrap">
{chainId === 1 ? 'Mainnet' : 'Sepolia'}
</p>
<Switch
checked={chainId === 1}
onCheckedChange={() => {
switchChainAsync({
chainId: chainId === 1 ? 11155111 : 1,
});
}}
/>
</div>
</div>
<div className="w-full h-[1px] min-h-[1px] bg-[#CBD5E180]" />
<ClaimSection />
<div className="w-full h-[1px] min-h-[1px] bg-[#CBD5E180]" />
<SignSection />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const PluginsSection: FC = () => {
return (
<div className="flex flex-col gap-2.5">
<p className="text-base text-black font-bold leading-[125%] my-[5px]">
Plugins
Add Your Favorite Plugins
</p>

<Accordion type="single" collapsible className="w-full">
Expand Down
Loading

0 comments on commit daae6e0

Please sign in to comment.