Added hint for cmdk-menu (#1743)
* - added hint for cmdk-menu * - design
This commit is contained in:
@ -39,6 +39,7 @@ export const AppNavbar = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
openCommandMenu();
|
openCommandMenu();
|
||||||
}}
|
}}
|
||||||
|
keyboard={['⌘', 'K']}
|
||||||
/>
|
/>
|
||||||
<NavItem
|
<NavItem
|
||||||
label="Notifications"
|
label="Notifications"
|
||||||
|
|||||||
@ -18,6 +18,7 @@ type NavItemProps = {
|
|||||||
danger?: boolean;
|
danger?: boolean;
|
||||||
soon?: boolean;
|
soon?: boolean;
|
||||||
count?: number;
|
count?: number;
|
||||||
|
keyboard?: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
type StyledItemProps = {
|
type StyledItemProps = {
|
||||||
@ -58,6 +59,9 @@ const StyledItem = styled.button<StyledItemProps>`
|
|||||||
color: ${(props) =>
|
color: ${(props) =>
|
||||||
props.danger ? props.theme.color.red : props.theme.font.color.primary};
|
props.danger ? props.theme.color.red : props.theme.font.color.primary};
|
||||||
}
|
}
|
||||||
|
:hover .keyboard-shortcuts {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
@media (max-width: ${MOBILE_VIEWPORT}px) {
|
@media (max-width: ${MOBILE_VIEWPORT}px) {
|
||||||
@ -98,6 +102,17 @@ const StyledItemCount = styled.div`
|
|||||||
width: 16px;
|
width: 16px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const StyledKeyBoardShortcut = styled.div`
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: ${({ theme }) => theme.font.color.light};
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
margin-left: auto;
|
||||||
|
visibility: hidden;
|
||||||
|
`;
|
||||||
|
|
||||||
const NavItem = ({
|
const NavItem = ({
|
||||||
label,
|
label,
|
||||||
Icon,
|
Icon,
|
||||||
@ -107,6 +122,7 @@ const NavItem = ({
|
|||||||
danger,
|
danger,
|
||||||
soon,
|
soon,
|
||||||
count,
|
count,
|
||||||
|
keyboard,
|
||||||
}: NavItemProps) => {
|
}: NavItemProps) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -138,6 +154,11 @@ const NavItem = ({
|
|||||||
<StyledItemLabel>{label}</StyledItemLabel>
|
<StyledItemLabel>{label}</StyledItemLabel>
|
||||||
{soon && <StyledSoonPill>Soon</StyledSoonPill>}
|
{soon && <StyledSoonPill>Soon</StyledSoonPill>}
|
||||||
{!!count && <StyledItemCount>{count}</StyledItemCount>}
|
{!!count && <StyledItemCount>{count}</StyledItemCount>}
|
||||||
|
{keyboard && (
|
||||||
|
<StyledKeyBoardShortcut className="keyboard-shortcuts">
|
||||||
|
{keyboard.map((key) => key)}
|
||||||
|
</StyledKeyBoardShortcut>
|
||||||
|
)}
|
||||||
</StyledItem>
|
</StyledItem>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user