Skip to content

Commit

Permalink
replace buttons with links
Browse files Browse the repository at this point in the history
  • Loading branch information
riknoll committed Nov 1, 2024
1 parent e018e48 commit 3ba9c94
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
7 changes: 5 additions & 2 deletions react-common/components/controls/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface LinkProps extends ContainerProps {
href: string;
target?: "_self" | "_blank" | "_parent" | "_top";
tabIndex?: number;
title?: string;
}

export const Link = (props: LinkProps) => {
Expand All @@ -15,7 +16,8 @@ export const Link = (props: LinkProps) => {
href,
target,
children,
tabIndex
tabIndex,
title
} = props;

const classes = classList(
Expand All @@ -32,7 +34,8 @@ export const Link = (props: LinkProps) => {
target={target}
rel={target === "_blank" ? "noopener noreferrer" : ""}
tabIndex={tabIndex ?? 0}
>
title={title}
>
{children}
</a>
);
Expand Down
14 changes: 9 additions & 5 deletions react-common/components/controls/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as ReactDOM from "react-dom";
import { classList, ContainerProps } from "../util";
import { Button } from "./Button";
import { FocusTrap } from "./FocusTrap";
import { Link } from "./Link";

export interface ModalAction {
label: string;
Expand Down Expand Up @@ -86,13 +87,16 @@ export const Modal = (props: ModalProps) => {
</div>
{fullscreen && helpUrl &&
<div className="common-modal-help">
<Button
className="menu-button"
<Link
className="common-button menu-button"
title={lf("Help on {0} dialog", title)}
href={props.helpUrl}
onClick={() => {}}
rightIcon="fas fa-question"
/>
target="_blank"
>
<span className="common-button-flex">
<i className="fas fa-question" aria-hidden={true}/>
</span>
</Link>
</div>
}
{!fullscreen && !hideDismissButton &&
Expand Down
13 changes: 7 additions & 6 deletions react-common/components/extensions/ExtensionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Button } from "../controls/Button";
import { Card } from "../controls/Card";
import { LazyImage } from "../controls/LazyImage";
import { classList } from "../util";
import { Link } from "../controls/Link";

export interface ExtensionCardProps<U> {
title: string;
Expand Down Expand Up @@ -46,7 +47,7 @@ export const ExtensionCard = <U,>(props: ExtensionCardProps<U>) => {
<div className="common-extension-card-contents">
{!loading && <>
{imageUrl && <LazyImage src={imageUrl} alt={title} />}
<div className="common-extension-card-title" id={id + "-title"}>
<div className="common-extension-card-title" id={id + "-title"} title={title}>
{title}
</div>
<div className="common-extension-card-description">
Expand All @@ -58,13 +59,13 @@ export const ExtensionCard = <U,>(props: ExtensionCardProps<U>) => {
<div className="common-extension-card-extra-content">
{showDisclaimer && lf("User-provided extension, not endorsed by Microsoft.")}
{learnMoreUrl &&
<Button
<Link
className="link-button"
label={lf("Learn More")}
title={lf("Learn More")}
onClick={() => { }}
href={learnMoreUrl}
/>
target="_blank"
>
{lf("Learn More")}
</Link>
}
</div>
}
Expand Down
5 changes: 5 additions & 0 deletions react-common/styles/controls/Button.less
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@
background: none;
}

a.common-button.menu-button {
display: flex;
align-items: center;
}

/****************************************************
* Link Buttons *
****************************************************/
Expand Down
3 changes: 2 additions & 1 deletion react-common/styles/extensions/ExtensionCard.less
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
font-size: 18px;
padding: 0.5rem 1rem 0.25rem 1rem;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
flex-shrink: 0;
}
Expand Down Expand Up @@ -56,7 +57,7 @@
border-bottom-right-radius: 0.5rem;
}

.common-button.link-button {
a.link-button {
float: right;
}

Expand Down

0 comments on commit 3ba9c94

Please sign in to comment.