mirror of
https://github.com/stackblitz/bolt.new
synced 2025-02-06 04:48:04 +00:00
Merge pull request #433 from DiegoSouzaPW/feature/SlotCloneError
Check the render method of SlotClone. #432
This commit is contained in:
commit
6987ceae9e
@ -73,8 +73,8 @@ export const Messages = React.forwardRef<HTMLDivElement, MessagesProps>((props:
|
|||||||
</div>
|
</div>
|
||||||
{!isUserMessage && (
|
{!isUserMessage && (
|
||||||
<div className="flex gap-2 flex-col lg:flex-row">
|
<div className="flex gap-2 flex-col lg:flex-row">
|
||||||
<WithTooltip tooltip="Revert to this message">
|
|
||||||
{messageId && (
|
{messageId && (
|
||||||
|
<WithTooltip tooltip="Revert to this message">
|
||||||
<button
|
<button
|
||||||
onClick={() => handleRewind(messageId)}
|
onClick={() => handleRewind(messageId)}
|
||||||
key="i-ph:arrow-u-up-left"
|
key="i-ph:arrow-u-up-left"
|
||||||
@ -83,8 +83,8 @@ export const Messages = React.forwardRef<HTMLDivElement, MessagesProps>((props:
|
|||||||
'text-xl text-bolt-elements-textSecondary hover:text-bolt-elements-textPrimary transition-colors',
|
'text-xl text-bolt-elements-textSecondary hover:text-bolt-elements-textPrimary transition-colors',
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
|
||||||
</WithTooltip>
|
</WithTooltip>
|
||||||
|
)}
|
||||||
|
|
||||||
<WithTooltip tooltip="Fork chat from this message">
|
<WithTooltip tooltip="Fork chat from this message">
|
||||||
<button
|
<button
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { memo } from 'react';
|
import { memo, forwardRef, type ForwardedRef } from 'react';
|
||||||
import { classNames } from '~/utils/classNames';
|
import { classNames } from '~/utils/classNames';
|
||||||
|
|
||||||
type IconSize = 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
type IconSize = 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
||||||
@ -25,8 +25,11 @@ type IconButtonWithChildrenProps = {
|
|||||||
|
|
||||||
type IconButtonProps = IconButtonWithoutChildrenProps | IconButtonWithChildrenProps;
|
type IconButtonProps = IconButtonWithoutChildrenProps | IconButtonWithChildrenProps;
|
||||||
|
|
||||||
|
// Componente IconButton com suporte a refs
|
||||||
export const IconButton = memo(
|
export const IconButton = memo(
|
||||||
({
|
forwardRef(
|
||||||
|
(
|
||||||
|
{
|
||||||
icon,
|
icon,
|
||||||
size = 'xl',
|
size = 'xl',
|
||||||
className,
|
className,
|
||||||
@ -36,9 +39,12 @@ export const IconButton = memo(
|
|||||||
title,
|
title,
|
||||||
onClick,
|
onClick,
|
||||||
children,
|
children,
|
||||||
}: IconButtonProps) => {
|
}: IconButtonProps,
|
||||||
|
ref: ForwardedRef<HTMLButtonElement>,
|
||||||
|
) => {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
|
ref={ref}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'flex items-center text-bolt-elements-item-contentDefault bg-transparent enabled:hover:text-bolt-elements-item-contentActive rounded-md p-1 enabled:hover:bg-bolt-elements-item-backgroundActive disabled:cursor-not-allowed',
|
'flex items-center text-bolt-elements-item-contentDefault bg-transparent enabled:hover:text-bolt-elements-item-contentActive rounded-md p-1 enabled:hover:bg-bolt-elements-item-backgroundActive disabled:cursor-not-allowed',
|
||||||
{
|
{
|
||||||
@ -60,6 +66,7 @@ export const IconButton = memo(
|
|||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
function getIconSize(size: IconSize) {
|
function getIconSize(size: IconSize) {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import * as Tooltip from '@radix-ui/react-tooltip';
|
import * as Tooltip from '@radix-ui/react-tooltip';
|
||||||
|
import { forwardRef, type ForwardedRef, type ReactElement } from 'react';
|
||||||
|
|
||||||
interface TooltipProps {
|
interface TooltipProps {
|
||||||
tooltip: React.ReactNode;
|
tooltip: React.ReactNode;
|
||||||
children: React.ReactNode;
|
children: ReactElement;
|
||||||
sideOffset?: number;
|
sideOffset?: number;
|
||||||
className?: string;
|
className?: string;
|
||||||
arrowClassName?: string;
|
arrowClassName?: string;
|
||||||
@ -12,7 +13,9 @@ interface TooltipProps {
|
|||||||
delay?: number;
|
delay?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const WithTooltip = ({
|
const WithTooltip = forwardRef(
|
||||||
|
(
|
||||||
|
{
|
||||||
tooltip,
|
tooltip,
|
||||||
children,
|
children,
|
||||||
sideOffset = 5,
|
sideOffset = 5,
|
||||||
@ -22,7 +25,9 @@ const WithTooltip = ({
|
|||||||
position = 'top',
|
position = 'top',
|
||||||
maxWidth = 250,
|
maxWidth = 250,
|
||||||
delay = 0,
|
delay = 0,
|
||||||
}: TooltipProps) => {
|
}: TooltipProps,
|
||||||
|
_ref: ForwardedRef<HTMLElement>,
|
||||||
|
) => {
|
||||||
return (
|
return (
|
||||||
<Tooltip.Root delayDuration={delay}>
|
<Tooltip.Root delayDuration={delay}>
|
||||||
<Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
|
<Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
|
||||||
@ -68,6 +73,7 @@ const WithTooltip = ({
|
|||||||
</Tooltip.Portal>
|
</Tooltip.Portal>
|
||||||
</Tooltip.Root>
|
</Tooltip.Root>
|
||||||
);
|
);
|
||||||
};
|
},
|
||||||
|
);
|
||||||
|
|
||||||
export default WithTooltip;
|
export default WithTooltip;
|
||||||
|
Loading…
Reference in New Issue
Block a user