Skip to content

Commit f62e1bd

Browse files
committed
docs: add some funny random hero images
1 parent 9c48159 commit f62e1bd

File tree

8 files changed

+61
-6
lines changed

8 files changed

+61
-6
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<script setup lang="ts">
2+
import { onMounted, ref } from "vue";
3+
import { withBase } from "vitepress";
4+
5+
type HeroImage = {
6+
src: string;
7+
alt: string;
8+
};
9+
10+
const HERO_IMAGES: HeroImage[] = [
11+
{ src: "/robotcode-toy-tray.png", alt: "RobotCode figurines on a tray" },
12+
{ src: "/robotcode-vintage.png", alt: "Vintage RobotCode poster" },
13+
{ src: "/robotcode-vintage-new.png", alt: "New vintage RobotCode artwork" },
14+
{ src: "/robotcode-golf.png", alt: "RobotCode playing golf" },
15+
{ src: "/robotcode-golf.png", alt: "RobotCode playing golf" },
16+
{ src: "/robotcode-rock.png", alt: "RobotCode playing rock music" },
17+
{ src: "/robotcode-soccer.png", alt: "RobotCode playing soccer" },
18+
// { src: "/robotcode-vintage-christmas.png", alt: "Festive RobotCode postcard" },
19+
];
20+
21+
const hero = ref<HeroImage>(HERO_IMAGES[0]);
22+
23+
const pickRandomHero = () => {
24+
if (HERO_IMAGES.length <= 1) {
25+
return;
26+
}
27+
const index = Math.floor(Math.random() * HERO_IMAGES.length);
28+
hero.value = HERO_IMAGES[index];
29+
};
30+
31+
onMounted(() => {
32+
pickRandomHero();
33+
});
34+
</script>
35+
36+
<template>
37+
<div class="random-hero">
38+
<img class="VPImage image-src" :src="withBase(hero.src)" :alt="hero.alt" loading="eager" decoding="async" />
39+
</div>
40+
</template>
41+
42+
<style scoped>
43+
.random-hero {
44+
display: flex;
45+
justify-content: center;
46+
width: 100%;
47+
}
48+
49+
.image-src {
50+
width: auto;
51+
height: auto;
52+
max-width: 100%;
53+
}
54+
</style>

docs/.vitepress/theme/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { Theme } from "vitepress";
44
import { inBrowser } from "vitepress";
55
import DefaultTheme from "vitepress/theme";
66
import { enhanceAppWithTabs } from "vitepress-plugin-tabs/client";
7+
import RandomHeroImage from "./components/RandomHeroImage.vue";
78
import "./style.css";
89
import "lite-youtube-embed/src/lite-yt-embed.css";
910

@@ -14,11 +15,11 @@ if (inBrowser) {
1415

1516
export default {
1617
extends: DefaultTheme,
17-
Layout: () => {
18-
return h(DefaultTheme.Layout, null, {
19-
// https://vitepress.dev/guide/extending-default-theme#layout-slots
20-
});
21-
},
18+
Layout: () =>
19+
h(DefaultTheme.Layout, null, {
20+
// Render a randomized hero image each time the page loads in the browser.
21+
"home-hero-image": () => h(RandomHeroImage),
22+
}),
2223
enhanceApp({ app, router, siteData }) {
2324
// ...
2425
enhanceAppWithTabs(app);

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ hero:
66
text: Robot Framework IDE & CLI, the friendly way.
77
tagline: Language server, debugger, analyzer, REPL, and shareable profiles for IDE & CI
88
image:
9-
src: /robotcode-vintage.png
9+
src: /robotcode-toy-tray.png
1010
alt: RobotCode Logo
1111
actions:
1212
- theme: brand

docs/public/robotcode-golf.png

2.57 MB
Loading

docs/public/robotcode-golf2.png

2.54 MB
Loading

docs/public/robotcode-rock.png

2.53 MB
Loading

docs/public/robotcode-soccer.png

2.43 MB
Loading

docs/public/robotcode-toy-tray.png

2.8 MB
Loading

0 commit comments

Comments
 (0)