Skip to content
Snippets Groups Projects
Verified Commit 766d6cf2 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: conditional URL methods

parent 66ce90e2
No related branches found
No related tags found
1 merge request!9Version 0.4.0 🍾
Pipeline #1404 passed
......@@ -85,7 +85,7 @@ export interface Emulator extends ObservableI {
*/
getDevice(): string;
getDeviceUrl(): string;
getDeviceUrl?(): string;
/**
* Obtains a semantic version string for the current
......@@ -103,7 +103,7 @@ export interface Emulator extends ObservableI {
* @returns A URL to the page describing the current version
* of the emulator.
*/
getVersionUrl(): string;
getVersionUrl?(): string;
/**
* Obtains the pixel format of the emulator's display
......@@ -398,15 +398,26 @@ export const App: FC<AppProps> = ({ emulator, backgrounds = ["264653"] }) => {
<Title
text={emulator.getName()}
version={emulator.getVersion()}
versionUrl={emulator.getVersionUrl()}
versionUrl={
emulator.getVersionUrl
? emulator.getVersionUrl()
: undefined
}
iconSrc={require("../res/thunder.png")}
></Title>
<Section>
<Paragraph>
This is a{" "}
<Link href={emulator.getDeviceUrl()} target="_blank">
{emulator.getDevice()}
</Link>{" "}
{emulator.getDeviceUrl ? (
<Link
href={emulator.getDeviceUrl()}
target="_blank"
>
{emulator.getDevice()}
</Link>
) : (
emulator.getDevice()
)}{" "}
emulator built using the{" "}
<Link href="https://www.rust-lang.org" target="_blank">
Rust Programming Language
......
.title > .link {
.title > .link,
.title > .label {
margin-left: 14px;
}
......
......@@ -22,11 +22,14 @@ export const Title: FC<TitleProps> = ({
return (
<h1 className={classes()}>
{text}
{version && (
<Link href={versionUrl} target="_blank">
{version}
</Link>
)}
{version &&
(versionUrl ? (
<Link href={versionUrl} target="_blank">
{version}
</Link>
) : (
<span className="label">{version}</span>
))}
{iconSrc && <img className="icon" src={iconSrc} alt="icon" />}
</h1>
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment