From 1c2432c784defcd757c91ad7963be2330bcd7c7a Mon Sep 17 00:00:00 2001 From: Petter Rasmussen Date: Wed, 7 Aug 2024 19:47:41 +0200 Subject: [PATCH] Add links to github, x, discord --- glot_core/src/layout/app_layout.rs | 39 ++++++++++++++++++++++++++++-- glot_core/src/view/mod.rs | 1 + glot_core/src/view/svg.rs | 39 ++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 glot_core/src/view/svg.rs diff --git a/glot_core/src/layout/app_layout.rs b/glot_core/src/layout/app_layout.rs index a54e24e..07c1048 100644 --- a/glot_core/src/layout/app_layout.rs +++ b/glot_core/src/layout/app_layout.rs @@ -1,4 +1,5 @@ use crate::common::route::Route; +use crate::view::svg; use maud::html; use maud::Markup; use poly::browser::dom_id::DomId; @@ -126,14 +127,14 @@ impl SidebarItem { html! { @if route.name() == current_route.name() { a href=(route.to_path()) class="bg-gray-900 text-white group flex items-center px-2 py-2 text-base font-medium rounded-md" { - span class="text-gray-300 mr-4 flex-shrink-0 h-6 w-6" { + span class="flex text-gray-300 mr-4 flex-shrink-0 h-6 w-6" { (self.icon) } (self.label) } } @else { a href=(route.to_path()) class="text-gray-300 hover:bg-gray-700 hover:text-white group flex items-center px-2 py-2 text-base font-medium rounded-md" { - span class="text-gray-400 group-hover:text-gray-300 mr-4 flex-shrink-0 h-6 w-6" { + span class="flex text-gray-400 group-hover:text-gray-300 mr-4 flex-shrink-0 h-6 w-6" { (self.icon) } (self.label) @@ -208,6 +209,23 @@ pub fn app_shell( (item.view(current_route)) } } + div class="mx-4 flex mb-4 gap-6" { + a href="https://twitter.com/glotcode" target="_blank" { + span class="flex w-6 h-6" { + (svg::x_logo()) + } + } + a href="https://discord.gg/5fyVwp8559" target="_blank" { + span class="flex w-6 h-6" { + (svg::discord_logo()) + } + } + a href="https://github.com/glotcode/glot" target="_blank" { + span class="flex w-6 h-6" { + (svg::github_logo()) + } + } + } div class="ml-4 text-white" { "Version: " a href=(commit_url) class="underline hover:no-underline text-gray-200 hover:text-gray-400 visited:text-purple-400" target="_blank" { @@ -233,6 +251,23 @@ pub fn app_shell( (item.view(current_route)) } } + div class="mx-4 flex mb-4 gap-6" { + a href="https://twitter.com/glotcode" target="_blank" { + span class="flex w-6 h-6" { + (svg::x_logo()) + } + } + a href="https://discord.gg/5fyVwp8559" target="_blank" { + span class="flex w-6 h-6" { + (svg::discord_logo()) + } + } + a href="https://github.com/glotcode/glot" target="_blank" { + span class="flex w-6 h-6" { + (svg::github_logo()) + } + } + } div class="ml-4 text-white" { "Version: " a href=(commit_url) class="underline hover:no-underline text-gray-200 hover:text-gray-400 visited:text-purple-400" target="_blank" { diff --git a/glot_core/src/view/mod.rs b/glot_core/src/view/mod.rs index cce0c5c..a8810c2 100644 --- a/glot_core/src/view/mod.rs +++ b/glot_core/src/view/mod.rs @@ -2,3 +2,4 @@ pub mod dropdown; pub mod features; pub mod language_grid; pub mod modal; +pub mod svg; diff --git a/glot_core/src/view/svg.rs b/glot_core/src/view/svg.rs new file mode 100644 index 0000000..3618d0e --- /dev/null +++ b/glot_core/src/view/svg.rs @@ -0,0 +1,39 @@ +use maud::{html, Markup}; + +pub fn github_logo() -> Markup { + html! { + svg viewBox="0 0 98 96" xmlns="http://www.w3.org/2000/svg" { + path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#fff" { + } + } + } +} + +pub fn x_logo() -> Markup { + html! { + svg viewBox="0 0 1200 1227" fill="none" xmlns="http://www.w3.org/2000/svg" { + path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z" fill="white" { + } + } + } +} + +pub fn discord_logo() -> Markup { + html! { + svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 127.14 96.36" { + defs { + style { + ".cls-1{fill:#fff;}" + } + } + g id="图层_2" data-name="图层 2" { + g id="Discord_Logos" data-name="Discord Logos" { + g id="Discord_Logo_-_Large_-_White" data-name="Discord Logo - Large - White" { + path class="cls-1" d="M107.7,8.07A105.15,105.15,0,0,0,81.47,0a72.06,72.06,0,0,0-3.36,6.83A97.68,97.68,0,0,0,49,6.83,72.37,72.37,0,0,0,45.64,0,105.89,105.89,0,0,0,19.39,8.09C2.79,32.65-1.71,56.6.54,80.21h0A105.73,105.73,0,0,0,32.71,96.36,77.7,77.7,0,0,0,39.6,85.25a68.42,68.42,0,0,1-10.85-5.18c.91-.66,1.8-1.34,2.66-2a75.57,75.57,0,0,0,64.32,0c.87.71,1.76,1.39,2.66,2a68.68,68.68,0,0,1-10.87,5.19,77,77,0,0,0,6.89,11.1A105.25,105.25,0,0,0,126.6,80.22h0C129.24,52.84,122.09,29.11,107.7,8.07ZM42.45,65.69C36.18,65.69,31,60,31,53s5-12.74,11.43-12.74S54,46,53.89,53,48.84,65.69,42.45,65.69Zm42.24,0C78.41,65.69,73.25,60,73.25,53s5-12.74,11.44-12.74S96.23,46,96.12,53,91.08,65.69,84.69,65.69Z" { + } + } + } + } + } + } +}