Skip to content

Commit bdc1d52

Browse files
authored
Merge pull request #25 from jeffglaum/website-repairs
add external-internal doc link support
2 parents dada268 + 5fe73e7 commit bdc1d52

File tree

7 files changed

+47
-6
lines changed

7 files changed

+47
-6
lines changed

src/components/documentation_training.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use leptos_router::components::A;
55
pub struct DocLink {
66
pub href: &'static str,
77
pub title: &'static str,
8+
pub external: bool,
89
}
910

1011
#[component]
@@ -58,12 +59,24 @@ pub fn DocumentationTraining(#[prop(default = vec![])] links: Vec<DocLink>) -> i
5859
<ul class="flex flex-col pt-4" style="width: 760px;">
5960
{links.into_iter().map(|link| view! {
6061
<li>
61-
<div class="link_large" style="text-decoration: none;">
62-
<a href=link.href target="_blank" style="text-decoration: none;">
63-
<span style="text-decoration: none;">{"→ "}</span>
64-
<span style="text-decoration: underline;">{link.title}</span>
65-
</a>
66-
</div>
62+
<Show
63+
when=move || link.external
64+
fallback= move || view! {
65+
<div class="link_large internal-link" style="text-decoration: none;">
66+
<A href=link.href>
67+
<span style="text-decoration: none;">{"→ "}</span>
68+
<span style="text-decoration: underline;">{link.title}</span>
69+
</A>
70+
</div>
71+
}
72+
>
73+
<div class="link_large external-link" style="text-decoration: none;">
74+
<a href=link.href target="_blank" style="text-decoration: none;">
75+
<span style="text-decoration: none;">{"→ "}</span>
76+
<span style="text-decoration: underline;">{link.title}</span>
77+
</a>
78+
</div>
79+
</Show>
6780
</li>
6881
}).collect_view()}
6982
</ul>

src/components/projects_component.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ pub fn ProjectsComponent() -> impl IntoView {
126126
href="https://opendevicepartnership.github.io/documentation/intro/concepts/patina.html"
127127
class="link"
128128
style="text-decoration: none;"
129+
target="_blank"
129130
>
130131
<span style="text-decoration: none;">{"→ "}</span>
131132
<span style="text-decoration: underline;">{"Read the Boot Firmware Guide"}</span>
@@ -181,6 +182,7 @@ pub fn ProjectsComponent() -> impl IntoView {
181182
href="https://opendevicepartnership.github.io/documentation/intro/concepts/Embedded_controller.html"
182183
class="link"
183184
style="text-decoration: none;"
185+
target="_blank"
184186
>
185187
<span style="text-decoration: none;">{"→ "}</span>
186188
<span style="text-decoration: underline;">{"Read the Secure EC Guide"}</span>
@@ -234,6 +236,7 @@ pub fn ProjectsComponent() -> impl IntoView {
234236
href="https://opendevicepartnership.github.io/documentation/intro/concepts/EC_Services.html"
235237
class="link"
236238
style="text-decoration: none;"
239+
target="_blank"
237240
>
238241
<span style="text-decoration: none;">{"→ "}</span>
239242
<span style="text-decoration: underline;">{"Read the EC Services Guide"}</span>

src/pages/boot_firmware.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,27 @@ pub fn BootFirmware() -> impl IntoView {
1313
DocLink {
1414
href: "https://opendevicepartnership.github.io/documentation/why/why.html",
1515
title: "Why ODP?",
16+
external: true,
1617
},
1718
DocLink {
1819
href: "https://opendevicepartnership.github.io/documentation/intro/welcome.html",
1920
title: "Getting Started with ODP",
21+
external: true,
2022
},
2123
DocLink {
2224
href: "https://opendevicepartnership.github.io/documentation/intro/tutorial/tutorial.html",
2325
title: "Tutorials",
26+
external: true,
2427
},
2528
DocLink {
2629
href: "https://opendevicepartnership.github.io/documentation/specs/specifications.html",
2730
title: "Specifications",
31+
external: true,
2832
},
2933
DocLink {
3034
href: "/community",
3135
title: "Contributing to ODP",
36+
external: false,
3237
},
3338
];
3439

src/pages/embedded_controller.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,27 @@ pub fn EmbeddedController() -> impl IntoView {
1313
DocLink {
1414
href: "https://opendevicepartnership.github.io/documentation/why/why.html",
1515
title: "Why ODP?",
16+
external: true,
1617
},
1718
DocLink {
1819
href: "https://opendevicepartnership.github.io/documentation/intro/welcome.html",
1920
title: "Getting Started with ODP",
21+
external: true,
2022
},
2123
DocLink {
2224
href: "https://opendevicepartnership.github.io/documentation/intro/tutorial/tutorial.html",
2325
title: "Tutorials",
26+
external: true,
2427
},
2528
DocLink {
2629
href: "https://opendevicepartnership.github.io/documentation/specs/specifications.html",
2730
title: "Specifications",
31+
external: true,
2832
},
2933
DocLink {
3034
href: "/community",
3135
title: "Contributing to ODP",
36+
external: false,
3237
},
3338
];
3439

src/pages/home.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,27 @@ pub fn Home() -> impl IntoView {
1313
DocLink {
1414
href: "https://opendevicepartnership.github.io/documentation/why/why.html",
1515
title: "Why ODP?",
16+
external: true,
1617
},
1718
DocLink {
1819
href: "https://opendevicepartnership.github.io/documentation/intro/welcome.html",
1920
title: "Getting Started with ODP",
21+
external: true,
2022
},
2123
DocLink {
2224
href: "https://opendevicepartnership.github.io/documentation/intro/tutorial/tutorial.html",
2325
title: "Tutorials",
26+
external: true,
2427
},
2528
DocLink {
2629
href: "https://opendevicepartnership.github.io/documentation/specs/specifications.html",
2730
title: "Specifications",
31+
external: true,
2832
},
2933
DocLink {
3034
href: "/community",
3135
title: "Contributing to ODP",
36+
external: false,
3237
},
3338
];
3439

src/pages/projects.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,27 @@ pub fn Projects() -> impl IntoView {
1212
DocLink {
1313
href: "https://opendevicepartnership.github.io/documentation/why/why.html",
1414
title: "Why ODP?",
15+
external: true,
1516
},
1617
DocLink {
1718
href: "https://opendevicepartnership.github.io/documentation/intro/welcome.html",
1819
title: "Getting Started with ODP",
20+
external: true,
1921
},
2022
DocLink {
2123
href: "https://opendevicepartnership.github.io/documentation/intro/tutorial/tutorial.html",
2224
title: "Tutorials",
25+
external: true,
2326
},
2427
DocLink {
2528
href: "https://opendevicepartnership.github.io/documentation/specs/specifications.html",
2629
title: "Specifications",
30+
external: true,
2731
},
2832
DocLink {
2933
href: "/community",
3034
title: "Contributing to ODP",
35+
external: false,
3136
},
3237
];
3338

src/pages/unified_ec_services.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,27 @@ pub fn WindowsEcServices() -> impl IntoView {
1313
DocLink {
1414
href: "https://opendevicepartnership.github.io/documentation/why/why.html",
1515
title: "Why ODP?",
16+
external: true,
1617
},
1718
DocLink {
1819
href: "https://opendevicepartnership.github.io/documentation/intro/welcome.html",
1920
title: "Getting Started with ODP",
21+
external: true,
2022
},
2123
DocLink {
2224
href: "https://opendevicepartnership.github.io/documentation/intro/tutorial/tutorial.html",
2325
title: "Tutorials",
26+
external: true,
2427
},
2528
DocLink {
2629
href: "https://opendevicepartnership.github.io/documentation/specs/specifications.html",
2730
title: "Specifications",
31+
external: true,
2832
},
2933
DocLink {
3034
href: "/community",
3135
title: "Contributing to ODP",
36+
external: false,
3237
},
3338
];
3439

0 commit comments

Comments
 (0)