fix(projects): preserve popover card width
This commit is contained in:
@@ -59,7 +59,8 @@ export function HomeProjectsSection() {
|
|||||||
architecture={getLocalizedValue(project.architecture, locale)}
|
architecture={getLocalizedValue(project.architecture, locale)}
|
||||||
technologiesLabel={tProjects("technologies")}
|
technologiesLabel={tProjects("technologies")}
|
||||||
architectureLabel={tProjects("architecture")}
|
architectureLabel={tProjects("architecture")}
|
||||||
className="aspect-square w-56 shrink-0 rounded-sm border-border md:w-[calc((100vw-8rem)/4)] md:max-w-56"
|
triggerClassName="w-56 shrink-0 md:w-[calc((100vw-8rem)/4)] md:max-w-56"
|
||||||
|
className="aspect-square rounded-sm border-border"
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ type ProjectCardWithPopoverProps = {
|
|||||||
technologiesLabel: string;
|
technologiesLabel: string;
|
||||||
architectureLabel: string;
|
architectureLabel: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
triggerClassName?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function ProjectCardWithPopover({
|
export function ProjectCardWithPopover({
|
||||||
@@ -33,6 +34,7 @@ export function ProjectCardWithPopover({
|
|||||||
technologiesLabel,
|
technologiesLabel,
|
||||||
architectureLabel,
|
architectureLabel,
|
||||||
className,
|
className,
|
||||||
|
triggerClassName,
|
||||||
}: ProjectCardWithPopoverProps) {
|
}: ProjectCardWithPopoverProps) {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||||
@@ -69,6 +71,7 @@ export function ProjectCardWithPopover({
|
|||||||
className={className}
|
className={className}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
const triggerClasses = `block ${triggerClassName ?? ""} text-inherit outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover open={open} onOpenChange={setOpen}>
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
@@ -76,7 +79,7 @@ export function ProjectCardWithPopover({
|
|||||||
{href ? (
|
{href ? (
|
||||||
<a
|
<a
|
||||||
href={href}
|
href={href}
|
||||||
className="block text-inherit no-underline outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
className={`${triggerClasses} no-underline`}
|
||||||
onPointerEnter={showPopover}
|
onPointerEnter={showPopover}
|
||||||
onPointerLeave={scheduleClose}
|
onPointerLeave={scheduleClose}
|
||||||
onFocus={showPopover}
|
onFocus={showPopover}
|
||||||
@@ -87,7 +90,7 @@ export function ProjectCardWithPopover({
|
|||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="block border-0 bg-transparent p-0 text-left text-inherit outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
className={`${triggerClasses} border-0 bg-transparent p-0 text-left`}
|
||||||
onPointerEnter={showPopover}
|
onPointerEnter={showPopover}
|
||||||
onPointerLeave={scheduleClose}
|
onPointerLeave={scheduleClose}
|
||||||
onFocus={showPopover}
|
onFocus={showPopover}
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ function ProjectSection({
|
|||||||
architecture={item.architecture}
|
architecture={item.architecture}
|
||||||
technologiesLabel={technologiesLabel}
|
technologiesLabel={technologiesLabel}
|
||||||
architectureLabel={architectureLabel}
|
architectureLabel={architectureLabel}
|
||||||
|
triggerClassName="w-full"
|
||||||
className="aspect-square rounded-sm border-border"
|
className="aspect-square rounded-sm border-border"
|
||||||
/>
|
/>
|
||||||
</StaggerItem>
|
</StaggerItem>
|
||||||
|
|||||||
Reference in New Issue
Block a user