Hardware page with more content.
Collapse component Signed-off-by: Martin Berg Alstad <git@martials.no>
This commit is contained in:
parent
beefabb908
commit
8ba480eab1
@ -8,6 +8,7 @@
|
|||||||
"myLinks": "My links",
|
"myLinks": "My links",
|
||||||
"myProjects": "My projects",
|
"myProjects": "My projects",
|
||||||
"hardware": "Hardware",
|
"hardware": "Hardware",
|
||||||
|
"accessories": "Accessories",
|
||||||
"sourceCode": "Source code",
|
"sourceCode": "Source code",
|
||||||
"createdAt": "Created at",
|
"createdAt": "Created at",
|
||||||
"updatedAt": "Updated at",
|
"updatedAt": "Updated at",
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
"myLinks": "Mine lenker",
|
"myLinks": "Mine lenker",
|
||||||
"myProjects": "Mine prosjekter",
|
"myProjects": "Mine prosjekter",
|
||||||
"hardware": "Maskinvare",
|
"hardware": "Maskinvare",
|
||||||
|
"accessories": "Tilbehør",
|
||||||
"sourceCode": "Kildekode",
|
"sourceCode": "Kildekode",
|
||||||
"createdAt": "Opprettet",
|
"createdAt": "Opprettet",
|
||||||
"updatedAt": "Oppdatert",
|
"updatedAt": "Oppdatert",
|
||||||
|
10
src/components/Collapse.svelte
Normal file
10
src/components/Collapse.svelte
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
export let title: string = ""
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<details class="collapse collapse-arrow bg-base-200">
|
||||||
|
<summary class="collapse-title text-xl font-medium">{title}</summary>
|
||||||
|
<div class="collapse-content">
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</details>
|
@ -1,23 +1,44 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Select from "./Select.svelte"
|
import Select from "./Select.svelte"
|
||||||
import { getCollection } from "astro:content"
|
import * as m from "@/paraglide/messages"
|
||||||
|
import Collapse from "@/components/Collapse.svelte"
|
||||||
|
|
||||||
getCollection("hardware")
|
export let hardware: any[] = []
|
||||||
.then((collection) => {
|
|
||||||
console.log(collection)
|
|
||||||
})
|
|
||||||
|
|
||||||
// TODO fetch selected hardware from content collection
|
const hardwareOptions = hardware.map((item) => ({
|
||||||
let selectedHardware: string = "CPU"
|
key: item.id,
|
||||||
|
value: item.data.title
|
||||||
|
}))
|
||||||
|
|
||||||
|
let selectedHardwareKey: string = hardware[0].id
|
||||||
|
$: selectedHardware = hardware.find((item) => item.id === selectedHardwareKey)!
|
||||||
|
|
||||||
function onChange({ detail }: CustomEvent<string>) {
|
function onChange({ detail }: CustomEvent<string>) {
|
||||||
console.log(detail)
|
selectedHardwareKey = detail
|
||||||
selectedHardware = detail
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO show the selected hardware
|
|
||||||
</script>
|
</script>
|
||||||
<div>
|
<div class="px-2 max-w-[750px] sm:min-w-[750px] w-screen">
|
||||||
<h2>{selectedHardware}</h2>
|
<h1 class="text-center">{m.hardware()}</h1>
|
||||||
<Select options={["CPU", "GPU", "RAM"]} on:change={onChange} />
|
<div>
|
||||||
|
<Select options={hardwareOptions} on:change={onChange} class="mx-auto w-max" />
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<Collapse title={m.hardware()}>
|
||||||
|
<ul>
|
||||||
|
{#each selectedHardware.data.hardware as item}
|
||||||
|
<li class="list-disc ml-5">{item}</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
</Collapse>
|
||||||
|
{#if (selectedHardware.data.accessories)}
|
||||||
|
<Collapse title={m.accessories()}>
|
||||||
|
<ul>
|
||||||
|
{#each selectedHardware.data.accessories as item}
|
||||||
|
<li class="list-disc ml-5">{item}</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
</Collapse>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
|
|
||||||
export let options: string[] = []
|
// TODO move to types?
|
||||||
|
interface Option {
|
||||||
|
key: string
|
||||||
|
value: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export let options: Option[] = []
|
||||||
|
// TODO bind data instead of dispatching events
|
||||||
const dispatch = createEventDispatcher<{ change: string }>()
|
const dispatch = createEventDispatcher<{ change: string }>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<select
|
<select
|
||||||
class="select select-bordered w-full max-w-xs"
|
class="select select-bordered w-full max-w-xs ${$$restProps.class}"
|
||||||
on:change={(value) => dispatch("change", value.currentTarget.value)}
|
on:change={(value) => dispatch("change", value.currentTarget.value)}
|
||||||
>
|
>
|
||||||
{#each options as option}
|
{#each options as { key, value }}
|
||||||
<option value={option}>{option}</option>
|
<option value={key}>{value}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</select>
|
</select>
|
||||||
|
@ -18,6 +18,7 @@ const projectCollection = defineCollection({
|
|||||||
const hardwareCollection = defineCollection({
|
const hardwareCollection = defineCollection({
|
||||||
type: "data",
|
type: "data",
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
|
title: z.string(),
|
||||||
accessories: z.optional(z.array(z.string())),
|
accessories: z.optional(z.array(z.string())),
|
||||||
hardware: z.array(z.string())
|
hardware: z.array(z.string())
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,23 @@
|
|||||||
|
title: Desktop
|
||||||
accessories:
|
accessories:
|
||||||
- a # Screens, keyboards, mice, etc.
|
- Gaming chair | Arozzi Mezzo V2 Gaming chair Fabric Black/Red # https://www.komplett.no/product/1079732?noredirect=true
|
||||||
|
- Headset | Logitech PRO X LIGHTSPEED Wireless Gaming Headset # https://www.komplett.no/product/1162749?noredirect=true
|
||||||
|
- Keyboard | Logitech G710
|
||||||
|
- Monitor 1 | AOC 27" LED FreeSync G2790PX # https://www.komplett.no/product/975642?noredirect=true
|
||||||
|
- Monitor 2 | Asus 28" 4K LED PB287Q # https://www.komplett.no/product/815114?noredirect=true
|
||||||
|
- Mouse | Logitech G502 HERO Gaming Mouse
|
||||||
|
- Mousepad | Svive Styx ESGR Gaming Mousepad XXL # https://www.komplett.no/product/985884?noredirect=true
|
||||||
|
- Speakers | Creative T6 Series II # https://www.komplett.no/product/808450?noredirect=true
|
||||||
hardware:
|
hardware:
|
||||||
- b # Graphics cards, CPUs, etc.
|
- Case | Fractal Design Define R5 (Black) # https://www.fractal-design.com/products/cases/define/define-r5/black/
|
||||||
|
- CPU | Intel Core i5-10600K CPU # https://www.komplett.no/product/1155669?noredirect=true
|
||||||
|
- CPU cooler | Noctua ...
|
||||||
|
- Fans | 4x Fractal Design R3 140mm Silent fan # https://www.komplett.no/product/836971?noredirect=true
|
||||||
|
- GPU | Palit GeForce RTX 2070 SUPER JetStream # https://www.komplett.no/product/1134511?noredirect=true
|
||||||
|
- HDD | Seagate Barracuda 3TB 3.5" # https://www.komplett.no/product/653074?noredirect=true
|
||||||
|
- Motherboard | Gigabyte H470 HD3 # https://www.komplett.no/product/1161192?noredirect=true
|
||||||
|
- Network card | TP-Link Archer TX3000E # https://www.komplett.no/product/1146481?noredirect=true
|
||||||
|
- Ram | 2x Corsair Vengeance LPX DDR4 3200MHz 16GB (black) # https://www.komplett.no/product/893831?noredirect=true
|
||||||
|
- SSD | Samsung 960 PRO 512GB M.2 PCIe SSD # https://www.komplett.no/product/903118?noredirect=true
|
||||||
|
- SSD | Corsair Force Series MP510 960GB M.2 NVMe SSD 960GB # https://www.komplett.no/product/1153863?noredirect=true
|
||||||
|
- PSU | Corsair CX750M, 750W PSU # https://www.komplett.no/product/773377?noredirect=true
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
|
title: Home Server
|
||||||
hardware:
|
hardware:
|
||||||
- b # Graphics cards, CPUs, etc.
|
- b # Graphics cards, CPUs, etc.
|
@ -1,3 +1,4 @@
|
|||||||
|
title: Raspberry Pi 4
|
||||||
accessories:
|
accessories:
|
||||||
- a # Screens, keyboards, mice, etc.
|
- a # Screens, keyboards, mice, etc.
|
||||||
hardware:
|
hardware:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
import Layout from "../../layouts/Layout.astro"
|
import Layout from "@/layouts/Layout.astro"
|
||||||
import HardwarePage from "../../components/HardwarePage.svelte"
|
import HardwarePage from "@/components/HardwarePage.svelte"
|
||||||
import "../../styles/global.css"
|
import "@/styles/global.css"
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Hardware" class="mx-auto max-w-[750px]">
|
<Layout title="Hardware" class="mx-auto max-w-[750px]">
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
---
|
---
|
||||||
import Layout from "../layouts/Layout.astro"
|
import Layout from "@/layouts/Layout.astro"
|
||||||
import HardwarePage from "../components/HardwarePage.svelte"
|
import HardwarePage from "@/components/HardwarePage.svelte"
|
||||||
import "../styles/global.css"
|
import "@/styles/global.css"
|
||||||
|
import { getCollection } from "astro:content"
|
||||||
|
|
||||||
|
const hardware = await getCollection("hardware")
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Hardware" class="mx-auto max-w-[750px]">
|
<Layout title="Hardware" class="mx-auto max-w-[750px]">
|
||||||
<h1 class="text-center">Hardware</h1>
|
<HardwarePage client:load hardware={hardware} />
|
||||||
<HardwarePage client:load />
|
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -9,7 +9,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@layer base {
|
@layer base {
|
||||||
|
br {
|
||||||
|
@apply my-4;
|
||||||
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
@apply text-4xl font-bold mb-2;
|
@apply text-4xl font-bold mb-2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
@apply text-3xl font-bold mb-2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user