Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace a few buttons with links #10256

Merged
merged 3 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
14 changes: 7 additions & 7 deletions react-common/components/extensions/ExtensionCard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from "react";
import { Button } from "../controls/Button";
import { Card } from "../controls/Card";
import { LazyImage } from "../controls/LazyImage";
import { classList } from "../util";
import { Link } from "../controls/Link";
riknoll marked this conversation as resolved.
Show resolved Hide resolved

export interface ExtensionCardProps<U> {
title: string;
Expand Down Expand Up @@ -46,7 +46,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 +58,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