mirror of https://github.com/buster-so/buster.git
extended refer
This commit is contained in:
parent
f4102880e5
commit
4b80fe7a66
|
@ -59,6 +59,20 @@ export const ShareMenuContentEmbedFooter = ({
|
||||||
openSuccessMessage('Succuessfully published');
|
openSuccessMessage('Succuessfully published');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const text = useMemo(() => {
|
||||||
|
if (assetType === 'metric_file') {
|
||||||
|
return 'Your metric currently isn’t published.';
|
||||||
|
} else if (assetType === 'dashboard_file') {
|
||||||
|
return 'Your dashboard currently isn’t published.';
|
||||||
|
} else if (assetType === 'chat') {
|
||||||
|
return 'Your chat currently isn’t published.';
|
||||||
|
} else if (assetType === 'report_file') {
|
||||||
|
return 'Your report currently isn’t published.';
|
||||||
|
} else {
|
||||||
|
return 'Your item currently isn’t published.';
|
||||||
|
}
|
||||||
|
}, [assetType]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-item-hover flex justify-start overflow-hidden rounded-b px-3 py-2.5">
|
<div className="bg-item-hover flex justify-start overflow-hidden rounded-b px-3 py-2.5">
|
||||||
<Text variant="secondary" className="text-xs!">
|
<Text variant="secondary" className="text-xs!">
|
||||||
|
|
|
@ -28,7 +28,7 @@ export interface InputTextAreaProps
|
||||||
onPressEnter?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
onPressEnter?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InputTextAreaRef {
|
export interface InputTextAreaRef extends HTMLTextAreaElement {
|
||||||
forceRecalculateHeight: () => void;
|
forceRecalculateHeight: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,9 +48,11 @@ export const InputTextArea = React.forwardRef<InputTextAreaRef, InputTextAreaPro
|
||||||
) => {
|
) => {
|
||||||
const textareaRef = useRef<HTMLTextAreaElement | null>(null);
|
const textareaRef = useRef<HTMLTextAreaElement | null>(null);
|
||||||
|
|
||||||
useImperativeHandle(
|
useImperativeHandle(ref, () => {
|
||||||
ref,
|
if (!textareaRef.current) {
|
||||||
() => ({
|
return null as unknown as InputTextAreaRef;
|
||||||
|
}
|
||||||
|
return Object.assign(textareaRef.current, {
|
||||||
forceRecalculateHeight: () => {
|
forceRecalculateHeight: () => {
|
||||||
if (textareaRef.current) {
|
if (textareaRef.current) {
|
||||||
// Force a recalculation by triggering an input event
|
// Force a recalculation by triggering an input event
|
||||||
|
@ -58,9 +60,8 @@ export const InputTextArea = React.forwardRef<InputTextAreaRef, InputTextAreaPro
|
||||||
textareaRef.current.dispatchEvent(event);
|
textareaRef.current.dispatchEvent(event);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
});
|
||||||
[]
|
}, []);
|
||||||
);
|
|
||||||
|
|
||||||
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { cn } from '@/lib/classMerge';
|
||||||
import { Button } from '../buttons/Button';
|
import { Button } from '../buttons/Button';
|
||||||
import ShapeSquare from '../icons/NucleoIconFilled/shape-square';
|
import ShapeSquare from '../icons/NucleoIconFilled/shape-square';
|
||||||
import { ArrowUp } from '../icons/NucleoIconOutlined';
|
import { ArrowUp } from '../icons/NucleoIconOutlined';
|
||||||
import { InputTextArea, type InputTextAreaProps } from './InputTextArea';
|
import { InputTextArea, type InputTextAreaProps, type InputTextAreaRef } from './InputTextArea';
|
||||||
|
|
||||||
const inputTextAreaButtonVariants = cva(
|
const inputTextAreaButtonVariants = cva(
|
||||||
'relative flex flex-col w-full items-center overflow-visible rounded-xl cursor-text border border-border transition-all duration-200',
|
'relative flex flex-col w-full items-center overflow-visible rounded-xl cursor-text border border-border transition-all duration-200',
|
||||||
|
@ -29,7 +29,7 @@ export interface InputTextAreaButtonProps extends Omit<InputTextAreaProps, 'vari
|
||||||
inputClassName?: string;
|
inputClassName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const InputTextAreaButton = forwardRef<HTMLTextAreaElement, InputTextAreaButtonProps>(
|
export const InputTextAreaButton = forwardRef<InputTextAreaRef, InputTextAreaButtonProps>(
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
className,
|
className,
|
||||||
|
@ -51,7 +51,7 @@ export const InputTextAreaButton = forwardRef<HTMLTextAreaElement, InputTextArea
|
||||||
) => {
|
) => {
|
||||||
const onSubmitPreflight = () => {
|
const onSubmitPreflight = () => {
|
||||||
if (disabled) return;
|
if (disabled) return;
|
||||||
const text = (textRef as React.RefObject<HTMLTextAreaElement | null>).current?.value || '';
|
const text = (textRef as React.RefObject<InputTextAreaRef | null>).current?.value || '';
|
||||||
onSubmit(text);
|
onSubmit(text);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue