(props)
| 1681 | } |
| 1682 | |
| 1683 | const QueryStatus: Component<QueryStatusProps> = (props) => { |
| 1684 | const theme = useTheme() |
| 1685 | const css = useQueryDevtoolsContext().shadowDOMTarget |
| 1686 | ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget }) |
| 1687 | : goober.css |
| 1688 | const styles = createMemo(() => { |
| 1689 | return theme() === 'dark' ? darkStyles(css) : lightStyles(css) |
| 1690 | }) |
| 1691 | |
| 1692 | const { colors, alpha } = tokens |
| 1693 | const t = (light: string, dark: string) => (theme() === 'dark' ? dark : light) |
| 1694 | |
| 1695 | let tagRef!: HTMLButtonElement |
| 1696 | |
| 1697 | const [mouseOver, setMouseOver] = createSignal(false) |
| 1698 | const [focused, setFocused] = createSignal(false) |
| 1699 | |
| 1700 | const showLabel = createMemo(() => { |
| 1701 | if (selectedQueryHash()) { |
| 1702 | if (panelWidth() < firstBreakpoint && panelWidth() > secondBreakpoint) { |
| 1703 | return false |
| 1704 | } |
| 1705 | } |
| 1706 | if (panelWidth() < secondBreakpoint) { |
| 1707 | return false |
| 1708 | } |
| 1709 | |
| 1710 | return true |
| 1711 | }) |
| 1712 | |
| 1713 | return ( |
| 1714 | <button |
| 1715 | onFocus={() => setFocused(true)} |
| 1716 | onBlur={() => setFocused(false)} |
| 1717 | onMouseEnter={() => setMouseOver(true)} |
| 1718 | onMouseLeave={() => { |
| 1719 | setMouseOver(false) |
| 1720 | setFocused(false) |
| 1721 | }} |
| 1722 | disabled={showLabel()} |
| 1723 | ref={tagRef} |
| 1724 | class={cx( |
| 1725 | styles().queryStatusTag, |
| 1726 | !showLabel() && |
| 1727 | css` |
| 1728 | cursor: pointer; |
| 1729 | &:hover { |
| 1730 | background: ${t( |
| 1731 | colors.gray[200], |
| 1732 | colors.darkGray[400], |
| 1733 | )}${alpha[80]}; |
| 1734 | } |
| 1735 | `, |
| 1736 | 'tsqd-query-status-tag', |
| 1737 | `tsqd-query-status-tag-${props.label.toLowerCase()}`, |
| 1738 | )} |
| 1739 | {...(mouseOver() || focused() |
| 1740 | ? { |
nothing calls this directly
no test coverage detected
searching dependent graphs…