Skip to content

Commit

Permalink
ToggleButton changes
Browse files Browse the repository at this point in the history
  • Loading branch information
insmac committed Oct 12, 2023
1 parent 54de305 commit 56dc02e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
10 changes: 7 additions & 3 deletions packages/web-console/src/components/Sidebar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import styled from "styled-components"
import { Box } from "../Box"

export const Sidebar = styled(Box).attrs({ flexDirection: "column" })<{align?: "top" | "bottom"}>`
export const Sidebar = styled(Box).attrs({ flexDirection: "column" })<{
align?: "top" | "bottom"
}>`
width: 4.5rem;
height: 100%;
background: ${({ theme }) => theme.color.backgroundDarker};
gap: 0;
gap: 1rem;
flex-shrink: 0;
justify-content: ${({align}) => align === "top" ? "flex-start" : "flex-end"};
justify-content: ${({ align }) =>
align === "top" ? "flex-start" : "flex-end"};
align-items: center;
`
13 changes: 6 additions & 7 deletions packages/web-console/src/components/ToggleButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
******************************************************************************/

import React, { forwardRef, Ref } from "react"
import styled, { css } from "styled-components"
import styled, { css, ThemeConsumer } from "styled-components"

import type { Color, FontSize } from "../../types"
import { color } from "../../utils"
Expand Down Expand Up @@ -65,14 +65,16 @@ const baseStyles = css<Props>`
display: flex;
align-items: center;
justify-content: center;
background: transparent;
background: ${({ selected, theme }) =>
selected ? "#2d303e" : "transparent"};
border: none;
outline: 0;
font-size: ${({ fontSize, theme }) => theme.fontSize[fontSize]};
font-weight: 400;
line-height: 1.15;
width: 4.5rem;
height: 4.5rem;
width: 3.5rem;
height: 3.5rem;
border-radius: 0.4rem;
cursor: pointer;
${bezierTransition};
${({ disabled }) => disabled && "cursor: default; pointer-events: none;"};
Expand All @@ -86,15 +88,12 @@ const baseStyles = css<Props>`

const getTheme = (normal: ThemeShape, hover: ThemeShape) =>
css<Props>`
background: ${color(normal.background)};
&:hover:not([disabled]) {
background: ${color(hover.background)};
opacity: 1;
}
&:active:not([disabled]) {
background: ${color(hover.background)};
filter: brightness(90%);
}
`
Expand Down
2 changes: 1 addition & 1 deletion packages/web-console/src/consts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ const BASE = process.env.NODE_ENV === "production" ? "fara" : "alurin"

export const API = `https://${BASE}.questdb.io`

export const BUTTON_ICON_SIZE = "30px"
export const BUTTON_ICON_SIZE = "26px"
8 changes: 4 additions & 4 deletions packages/web-console/src/scenes/Layout/help.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ export const Help = () => {
const handleShortcutsToggle = useCallback((active) => {
setShortcutsPopperActive(active)
}, [])
const [open, setOpen] = useState(false)

return (
<React.Fragment>
<DropdownMenu.Root modal={false}>
<DropdownMenu.Root modal={false} onOpenChange={setOpen}>
<DropdownMenu.Trigger asChild>
<HelpButton>
<HelpButton {...(open && { selected: true })}>
<IconWithTooltip
icon={
<TooltipWrapper>
Expand Down Expand Up @@ -131,11 +132,10 @@ export const Help = () => {
</DropdownMenuContent>
</DropdownMenu.Portal>
</DropdownMenu.Root>

<PopperToggle
active={shortcutsPopperActive}
onToggle={handleShortcutsToggle}
trigger={<div style={{ height: "0" }} />}
trigger={<React.Fragment />}
>
<Shortcuts />
</PopperToggle>
Expand Down

0 comments on commit 56dc02e

Please sign in to comment.