Skip to content

Commit

Permalink
Better separators
Browse files Browse the repository at this point in the history
  • Loading branch information
nekiro committed Dec 1, 2024
1 parent 8d9f8c0 commit 6dd1bf6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
26 changes: 10 additions & 16 deletions src/layout/SideBar.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
import React from "react";
import Panel from "@component/Panel";
import Label from "@component/Label";
import Link from "@component/Link";
import { Box, BoxProps, Flex } from "@chakra-ui/react";
import { Box, BoxProps } from "@chakra-ui/react";
import StripedTable from "@component/StrippedTable";
import { trpc } from "@util/trpc";

export interface LayoutProps extends BoxProps {}

const SideBar = (props: LayoutProps) => {
const topPlayers = trpc.player.top5.useQuery();
const status = trpc.status.status.useQuery();

return (
<Box minWidth="15em" {...props}>
<Panel header="Top 5 Level" isLoading={topPlayers.isLoading}>
<StripedTable
head={[{ text: "Name" }, { text: "Level" }]}
body={
topPlayers.data &&
topPlayers.data.map((player, index) => [
{
text: `${index + 1}. ${player.name}`,
href: `/character/${player.name}`,
},
{
text: player.level.toString(),
},
])
}
body={topPlayers.data?.map((player, index) => [
{
text: `${index + 1}. ${player.name}`,
href: `/character/${player.name}`,
},
{
text: player.level.toString(),
},
])}
/>
</Panel>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/layout/TopBar/TopBarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface TopBarItemProps extends BoxProps {

export const TopBarItem = ({ children, ...props }: TopBarItemProps) => {
return (
<Flex borderLeftWidth="1px" borderRightWidth="1px" borderColor="violet.400" paddingRight="15px" paddingLeft="15px" h="100%" {...props}>
<Flex borderColor="violet.400" paddingRight="15px" paddingLeft="15px" h="100%" {...props}>
{children}
</Flex>
);
Expand Down
4 changes: 3 additions & 1 deletion src/layout/TopBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Flex, Text } from "@chakra-ui/react";
import { Flex, Text, Box } from "@chakra-ui/react";
import { TopBarItem } from "./TopBarItem";
import { trpc } from "@util/trpc";

Expand All @@ -8,6 +8,7 @@ export const TopBar = () => {
return (
<Flex justifyContent="center" bgColor="blackAlpha.600" h="40px" borderBottomWidth="1px" borderColor="violet.400">
<Flex alignItems="center" flexDir="row" gap="5px">
<Box bgColor="violet.400" w="1px" h="100%" />
<TopBarItem alignItems="center" flexDirection="row">
<Text fontSize="md" color={status?.online ? "green" : "red"}>
{status?.onlineCount ?? "..."}
Expand All @@ -16,6 +17,7 @@ export const TopBar = () => {
players online
</Text>
</TopBarItem>
<Box bgColor="violet.400" w="1px" h="100%" />
</Flex>
</Flex>
);
Expand Down

0 comments on commit 6dd1bf6

Please sign in to comment.