mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-10-18 14:51:33 +08:00
54 lines
1010 B
TypeScript
54 lines
1010 B
TypeScript
import { StyledButton } from 'components/Styled';
|
|
import React from 'react';
|
|
|
|
import { styles } from './styles';
|
|
|
|
function EllipsedButton({
|
|
onToggleHandler,
|
|
setText,
|
|
value,
|
|
event,
|
|
buttonText,
|
|
}: Props): JSX.Element {
|
|
const isFullValueButton = buttonText === 'View full value';
|
|
|
|
const style = [styles.removePadding];
|
|
|
|
if (!isFullValueButton) {
|
|
style.push(styles.removeMargin);
|
|
} else {
|
|
style.push(styles.selectedSpanDetailsContainer);
|
|
style.push(styles.buttonContainer);
|
|
}
|
|
|
|
return (
|
|
<StyledButton
|
|
styledclass={style}
|
|
onClick={(): void => {
|
|
onToggleHandler(true);
|
|
setText({
|
|
subText: value,
|
|
text: event,
|
|
});
|
|
}}
|
|
type="link"
|
|
>
|
|
{buttonText}
|
|
</StyledButton>
|
|
);
|
|
}
|
|
|
|
interface Props {
|
|
onToggleHandler: (isOpen: boolean) => void;
|
|
setText: (text: { subText: string; text: string }) => void;
|
|
value: string;
|
|
event: string;
|
|
buttonText?: string;
|
|
}
|
|
|
|
EllipsedButton.defaultProps = {
|
|
buttonText: 'View full log event message',
|
|
};
|
|
|
|
export default EllipsedButton;
|