|
| 1 | +import styled from 'styled-components'; |
| 2 | +import { AtomicLink } from '../AtomicLink'; |
| 3 | +import { Logo } from '../Logo'; |
| 4 | +import { SideBarHeader } from './SideBarHeader'; |
| 5 | +import React from 'react'; |
| 6 | +import { FaGithub, FaDiscord, FaBook } from 'react-icons/fa'; |
| 7 | + |
| 8 | +interface AboutItem { |
| 9 | + icon: React.ReactNode; |
| 10 | + helper: string; |
| 11 | + href: string; |
| 12 | +} |
| 13 | + |
| 14 | +const aboutMenuItems: AboutItem[] = [ |
| 15 | + { |
| 16 | + icon: <FaGithub />, |
| 17 | + helper: 'Github; View the source code for this application', |
| 18 | + href: 'https://github.com/atomicdata-dev/atomic-data-browser', |
| 19 | + }, |
| 20 | + { |
| 21 | + icon: <FaDiscord />, |
| 22 | + helper: 'Discord; Chat with the Atomic Data community', |
| 23 | + href: 'https://discord.gg/a72Rv2P', |
| 24 | + }, |
| 25 | + { |
| 26 | + icon: <FaBook />, |
| 27 | + helper: 'Docs; Read the Atomic Data documentation', |
| 28 | + href: 'https://docs.atomicdata.dev', |
| 29 | + }, |
| 30 | +]; |
| 31 | + |
| 32 | +export function About() { |
| 33 | + return ( |
| 34 | + <> |
| 35 | + <SideBarHeader> |
| 36 | + <Logo style={{ height: '1.1rem', maxWidth: '100%' }} /> |
| 37 | + </SideBarHeader> |
| 38 | + <AboutWrapper> |
| 39 | + {aboutMenuItems.map(p => ( |
| 40 | + <AboutIcon key={p.helper} {...p} /> |
| 41 | + ))} |
| 42 | + </AboutWrapper> |
| 43 | + </> |
| 44 | + ); |
| 45 | +} |
| 46 | + |
| 47 | +const AboutWrapper = styled.div` |
| 48 | + --inner-padding: 0.5rem; |
| 49 | + display: flex; |
| 50 | + /* flex-direction: column; */ |
| 51 | + align-items: center; |
| 52 | + gap: 0.5rem; |
| 53 | + margin-left: calc(1rem - var(--inner-padding)); |
| 54 | +`; |
| 55 | + |
| 56 | +interface AboutIconProps { |
| 57 | + href?: string; |
| 58 | + icon: React.ReactNode; |
| 59 | + helper: string; |
| 60 | +} |
| 61 | + |
| 62 | +function AboutIcon({ icon, helper, href }: AboutIconProps) { |
| 63 | + return ( |
| 64 | + <StyledAtomicLink href={href} clean title={helper}> |
| 65 | + {icon} |
| 66 | + </StyledAtomicLink> |
| 67 | + ); |
| 68 | +} |
| 69 | + |
| 70 | +const StyledAtomicLink = styled(AtomicLink)` |
| 71 | + padding: 0.5rem; |
| 72 | + display: grid; |
| 73 | + place-items: center; |
| 74 | + aspect-ratio: 1 / 1; |
| 75 | + border-radius: ${p => p.theme.radius}; |
| 76 | + color: ${p => p.theme.colors.textLight}; |
| 77 | + font-size: 1.6rem; |
| 78 | + transition: color 0.1s ease-in-out, background-color 0.1s ease-in-out; |
| 79 | + &:hover, |
| 80 | + &:focus { |
| 81 | + background: ${p => p.theme.colors.bg1}; |
| 82 | + color: ${p => p.theme.colors.text}; |
| 83 | + } |
| 84 | +`; |
0 commit comments