Skip to content

Commit

Permalink
feat(react-components): hide buttons without text
Browse files Browse the repository at this point in the history
  • Loading branch information
VojtechVidra committed Nov 27, 2024
1 parent 11370c5 commit 1c7022b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
10 changes: 6 additions & 4 deletions workspaces/react-components/src/components/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BaseModal } from "../internal-components/modal";
export interface ModalProps {
title: string;
body: string;
continueText: string;
continueText?: string;
showCloseButton: boolean;
hideOverlay: boolean;

Expand All @@ -19,9 +19,11 @@ export const Modal: FC<ModalProps> = (props) => {
title={props.title}
body={props.body}
buttons={
<Button variant="primary" onClick={props.continue}>
{props.continueText}
</Button>
props.continueText ? (
<Button variant="primary" onClick={props.continue}>
{props.continueText}
</Button>
) : null
}
overlay={!props.hideOverlay}
onClose={props.showCloseButton ? props.close : undefined}
Expand Down
10 changes: 6 additions & 4 deletions workspaces/react-components/src/components/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Button } from "../internal-components/button";
export interface TooltipProps {
title: string;
body: string;
continueText: string;
continueText?: string;
targetElement: string;
showCloseButton: boolean;

Expand All @@ -21,9 +21,11 @@ export const Tooltip: FC<TooltipProps> = (props) => {
targetElement={props.targetElement}
onClose={props.showCloseButton ? props.close : undefined}
buttons={
<Button variant="primary" onClick={props.continue}>
{props.continueText}
</Button>
props.continueText ? (
<Button variant="primary" onClick={props.continue}>
{props.continueText}
</Button>
) : null
}
/>
);
Expand Down
14 changes: 8 additions & 6 deletions workspaces/react-components/src/tour-components/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { Button } from "../internal-components/button";
export type ModalProps = TourComponentProps<{
title: string;
body: string;
continueText: string;
previousText: string;
continueText?: string;
previousText?: string;
showCloseButton: boolean;
hideOverlay: boolean;
}>;
Expand All @@ -20,14 +20,16 @@ export const Modal: FC<ModalProps> = (props) => {
overlay={!props.hideOverlay}
buttons={
<>
{props.previous ? (
{props.previous && props.previousText ? (
<Button variant="secondary" onClick={props.previous}>
{props.previousText}
</Button>
) : null}
<Button variant="primary" onClick={props.continue}>
{props.continueText}
</Button>
{props.continueText ? (
<Button variant="primary" onClick={props.continue}>
{props.continueText}
</Button>
) : null}
</>
}
onClose={props.showCloseButton ? props.cancel : undefined}
Expand Down
14 changes: 8 additions & 6 deletions workspaces/react-components/src/tour-components/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { Button } from "../internal-components/button";
export type TooltipProps = TourComponentProps<{
title: string;
body: string;
continueText: string;
previousText: string;
continueText?: string;
previousText?: string;
showCloseButton: boolean;
targetElement: string;
}>;
Expand All @@ -21,14 +21,16 @@ export const Tooltip: FC<TooltipProps> = (props) => {
onClose={props.showCloseButton ? props.cancel : undefined}
buttons={
<>
{props.previous ? (
{props.previous && props.previousText ? (
<Button variant="secondary" onClick={props.previous}>
{props.previousText}
</Button>
) : null}
<Button variant="primary" onClick={props.continue}>
{props.continueText}
</Button>
{props.continueText ? (
<Button variant="primary" onClick={props.continue}>
{props.continueText}
</Button>
) : null}
</>
}
/>
Expand Down

0 comments on commit 1c7022b

Please sign in to comment.