From 9b09af1491ae83ed72ff156577a94d08517153dd Mon Sep 17 00:00:00 2001 From: cikzh Date: Fri, 1 Nov 2024 11:59:00 +0100 Subject: [PATCH 1/2] Added category styling --- frontend/src/app.css | 2 + frontend/src/lib/Crate.svelte | 318 ++++++++++++++++++---------------- 2 files changed, 170 insertions(+), 150 deletions(-) diff --git a/frontend/src/app.css b/frontend/src/app.css index 089a3c5..fba62a3 100644 --- a/frontend/src/app.css +++ b/frontend/src/app.css @@ -20,6 +20,8 @@ --color-text: #f9f9f9; --color-text-secondary: #747bff; --color-border: #3a3939; + + --radius: 8px; } @media (prefers-color-scheme: light) { diff --git a/frontend/src/lib/Crate.svelte b/frontend/src/lib/Crate.svelte index 1dc0219..85da2fb 100644 --- a/frontend/src/lib/Crate.svelte +++ b/frontend/src/lib/Crate.svelte @@ -1,168 +1,186 @@
-
-
- {crate.categories || []} -
-
- {crate.name} - {crate.version} - - {#if crate.documentation}📚 Docs{/if} - {#if crate.repository}🗃️ Repo{/if} - {#if crate.homepage}🏠 Homepage{/if} -
- {#if crate.names.length > 0 || crate.part_numbers } -
- 🕷️ Supported chips: {crate.names.join(", ")} -
- {/if} -
- {crate.description} -
-
    - {#each crate.categories || [] as category} -
  • {category}
  • - {/each} -
+
+
    + {#each crate.categories || ["Test::Category", "Test::Category"] as category} +
  • {category}
  • + {/each} +
+
+ {crate.name} + {crate.version} + + {#if crate.documentation}📚 Docs{/if} + {#if crate.repository}🗃️ Repo{/if} + {#if crate.homepage}🏠 Homepage{/if}
-
- {#if crate.manufacturer !== "Unknown" } -
🛠️ Manufacturer: {crate.manufacturer}
- {/if} - {#if crate.interfaces && (crate.interfaces.i2c || crate.interfaces.spi) } -
🚌 Interfaces: - {#if crate.interfaces.i2c}I2C{/if} - {#if crate.interfaces.spi}SPI{/if} -
- {/if} - {#if crate.rust_version } -
🛠️ MSRV: {crate.rust_version}
- {/if} - {#if crate.datasheets } - - {/if} - {#if crate.dev_boards } -
- - {#if showDevBoards} -
    - {#each crate.dev_boards || [] as board} -
  • {board.name}
  • - {/each} -
- {/if} -
- {/if} - {#if crate.kicad_symbol} -
- - {#if showKiCadSymbol} -
    - {#each crate.kicad_symbol as sym} -
  • {sym}
  • - {/each} -
- {/if} -
- {/if} - {#if crate.packages} -
👣 Footprints: {crate.packages.join(", ")}
- {/if} - {#if crate.resources} -
- 🗞️ Resources: - -
- {/if} + {#if crate.names.length > 0 || crate.part_numbers } +
+ 🕷️ Supported chips: {crate.names.join(", ")} +
+ {/if} +
+ {crate.description}
-
-
👮 License: {crate.license}
-
⬇️ All-Time: {crate.downloads}
-
⬇️ This version: {crate.this_version_downloads}
-
- 🔄 Last updated: - -
- {#if crate.crate_size} -
🏋️ Size: {(crate.crate_size / 1024).toFixed(1)} kB
+
+
+ {#if crate.manufacturer !== "Unknown" } +
🛠️ Manufacturer: {crate.manufacturer}
+ {/if} + {#if crate.interfaces && (crate.interfaces.i2c || crate.interfaces.spi) } +
🚌 Interfaces: + {#if crate.interfaces.i2c}I2C{/if} + {#if crate.interfaces.spi}SPI{/if} +
+ {/if} + {#if crate.rust_version } +
🛠️ MSRV: {crate.rust_version}
+ {/if} + {#if crate.datasheets } + + {/if} + {#if crate.dev_boards } +
+ + {#if showDevBoards} +
    + {#each crate.dev_boards || [] as board} +
  • {board.name}
  • + {/each} +
{/if} +
+ {/if} + {#if crate.kicad_symbol} +
+ + {#if showKiCadSymbol} +
    + {#each crate.kicad_symbol as sym} +
  • {sym}
  • + {/each} +
+ {/if} +
+ {/if} + {#if crate.packages} +
👣 Footprints: {crate.packages.join(", ")}
+ {/if} + {#if crate.resources} +
+ 🗞️ Resources: + +
+ {/if} +
+
+
👮 License: {crate.license}
+
⬇️ All-Time: {crate.downloads}
+
⬇️ This version: {crate.this_version_downloads}
+
+ 🔄 Last updated: +
+ {#if crate.crate_size} +
🏋️ Size: {(crate.crate_size / 1024).toFixed(1)} kB
+ {/if} +
From 80017171aa219fd1f9d143fa8c96857fa03da287 Mon Sep 17 00:00:00 2001 From: cikzh Date: Fri, 1 Nov 2024 12:36:39 +0100 Subject: [PATCH 2/2] Crate card styling --- frontend/src/lib/Crate.svelte | 97 ++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 41 deletions(-) diff --git a/frontend/src/lib/Crate.svelte b/frontend/src/lib/Crate.svelte index 85da2fb..c1466e1 100644 --- a/frontend/src/lib/Crate.svelte +++ b/frontend/src/lib/Crate.svelte @@ -24,20 +24,16 @@ function toggleDevBoards() { } - -
+
-
    - {#each crate.categories || ["Test::Category", "Test::Category"] as category} -
  • {category}
  • - {/each} -
-
- {crate.name} +
+ {crate.name} {crate.version} +
+ {/if} -
+
{crate.description}
+
    + {#each crate.categories || [] as category} +
  • {category}
  • + {/each} +
+
{#if crate.manufacturer !== "Unknown" } -
🛠️ Manufacturer: {crate.manufacturer}
+

🛠️ Manufacturer: {crate.manufacturer}

{/if} {#if crate.interfaces && (crate.interfaces.i2c || crate.interfaces.spi) } -
🚌 Interfaces: +

🚌 Interfaces: {#if crate.interfaces.i2c}I2C{/if} {#if crate.interfaces.spi}SPI{/if} -

+

{/if} {#if crate.rust_version } -
🛠️ MSRV: {crate.rust_version}
+

🛠️ MSRV: {crate.rust_version}

{/if} {#if crate.datasheets } - +

📋 Datasheet

{/if} {#if crate.dev_boards } -
+

{#if showDevBoards}

    @@ -77,10 +79,10 @@ function toggleDevBoards() { {/each}
{/if} -
+

{/if} {#if crate.kicad_symbol} -
+

@@ -91,10 +93,10 @@ function toggleDevBoards() { {/each} {/if} -

+

{/if} {#if crate.packages} -
👣 Footprints: {crate.packages.join(", ")}
+

👣 Footprints: {crate.packages.join(", ")}

{/if} {#if crate.resources}
@@ -108,23 +110,23 @@ function toggleDevBoards() { {/if}
-
👮 License: {crate.license}
-
⬇️ All-Time: {crate.downloads}
-
⬇️ This version: {crate.this_version_downloads}
-
+

👮 License: {crate.license}

+

⬇️ All-Time: {crate.downloads}

+

⬇️ This version: {crate.this_version_downloads}

+

🔄 Last updated: -

+

{#if crate.crate_size} -
🏋️ Size: {(crate.crate_size / 1024).toFixed(1)} kB
+

🏋️ Size: {(crate.crate_size / 1024).toFixed(1)} kB

{/if}