Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪟🎨Main menu hover state #13762

Merged
merged 25 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bc646ba
hover, active states. transition.
teallarson Jun 14, 2022
81e119c
add parent behavior
teallarson Jun 14, 2022
c565ba7
remove extra jsx fragment
teallarson Jun 14, 2022
b3d11c1
basic behavior for cloud
teallarson Jun 14, 2022
483cc29
add focus-visible
teallarson Jun 15, 2022
6b37741
add changes to cloud, update to new theme
teallarson Jun 28, 2022
933ea4b
import other stylesheet
teallarson Jun 30, 2022
6cd5613
hover, active states. transition.
teallarson Jun 14, 2022
d895358
add parent behavior
teallarson Jun 14, 2022
fbb682e
remove extra jsx fragment
teallarson Jun 14, 2022
bb67a6b
basic behavior for cloud
teallarson Jun 14, 2022
bee2b3b
add changes to cloud, update to new theme
teallarson Jun 28, 2022
d0f5b4c
Update airbyte-webapp/src/views/layout/SideBar/SideBar.tsx
teallarson Jun 29, 2022
0167cd2
class name utility
teallarson Jun 30, 2022
6275da0
consolidate classname logic to shared function
teallarson Jun 30, 2022
923204d
Revert "Merge branch 'teal/main-menu-hover-state' of https://github.c…
teallarson Jun 30, 2022
8241812
fix rebase things
teallarson Jun 30, 2022
1a7c2da
border radius tweak from figma
teallarson Jun 30, 2022
cfd49ae
cleanup
teallarson Jun 30, 2022
e64c263
disable eslint for this line... these classes _are_ used
teallarson Jul 1, 2022
6dde4d1
cleanup file from other pr
teallarson Jul 7, 2022
83fc175
cleanup
teallarson Jul 7, 2022
97df035
fix settings glitch
teallarson Jul 8, 2022
2ce4e45
popout menu gets hover state when open
teallarson Jul 8, 2022
9de13c1
Merge branch 'master' into teal/main-menu-hover-state
teallarson Jul 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions airbyte-webapp/src/components/base/Popout/Popout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ const ControlComponent = (props: ControlProps<Value, false>) => (
<div ref={props.innerRef}>
{props.selectProps.selectProps.targetComponent({
onOpen: props.selectProps.selectProps.onOpen,
isOpen: props.selectProps.menuIsOpen,
value: props.selectProps.value,
})}
</div>
);

type PopoutProps = DropdownProps & {
interface PopoutProps extends DropdownProps {
targetComponent: (props: { onOpen: () => void; isOpen?: boolean; value: Value }) => ReactNode;
};
}

const Popout: React.FC<PopoutProps> = ({ onChange, targetComponent, ...props }) => {
const [isOpen, toggleOpen] = useToggle(false);
Expand Down Expand Up @@ -61,7 +62,10 @@ const Popout: React.FC<PopoutProps> = ({ onChange, targetComponent, ...props })
return (
<>
<DropDown
selectProps={{ targetComponent, onOpen: toggleOpen }}
selectProps={{
targetComponent,
onOpen: toggleOpen,
}}
autoFocus
backspaceRemovesValue={false}
controlShouldRenderValue={false}
Expand Down
62 changes: 21 additions & 41 deletions airbyte-webapp/src/packages/cloud/views/layout/SideBar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import SettingsIcon from "views/layout/SideBar/components/SettingsIcon";
import SidebarPopout, { Icon, Item } from "views/layout/SideBar/components/SidebarPopout";
import SourceIcon from "views/layout/SideBar/components/SourceIcon";
import { NotificationIndicator } from "views/layout/SideBar/NotificationIndicator";
import { useCalculateSidebarStyles, getPopoutStyles } from "views/layout/SideBar/SideBar";

import { RoutePaths } from "../../../../../pages/routePaths";

Expand Down Expand Up @@ -51,29 +52,6 @@ const Menu = styled.ul`
width: 100%;
`;

const MenuItem = styled(NavLink)`
color: ${({ theme }) => theme.greyColor30};
width: 100%;
cursor: pointer;
border-radius: 4px;
height: 70px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-weight: normal;
font-size: 12px;
line-height: 15px;
margin-top: 7px;
text-decoration: none;
position: relative;

&.active {
color: ${({ theme }) => theme.whiteColor};
background: ${({ theme }) => theme.primaryColor};
}
`;

const Text = styled.div`
margin-top: 7px;
`;
Expand Down Expand Up @@ -102,6 +80,8 @@ const SideBar: React.FC = () => {
const { show } = useIntercom();
const handleChatUs = () => show();

const navLinkClassName = useCalculateSidebarStyles();

return (
<Bar>
<div>
Expand All @@ -114,58 +94,58 @@ const SideBar: React.FC = () => {
<Menu>
{workspace.displaySetupWizard ? (
<li>
<MenuItem to={RoutePaths.Onboarding}>
<NavLink className={navLinkClassName} to={RoutePaths.Onboarding}>
<OnboardingIcon />
<Text>
<FormattedMessage id="sidebar.onboarding" />
</Text>
</MenuItem>
</NavLink>
</li>
) : null}
<li>
<MenuItem to={RoutePaths.Connections}>
<NavLink className={navLinkClassName} to={RoutePaths.Connections}>
<ConnectionsIcon />
<Text>
<FormattedMessage id="sidebar.connections" />
</Text>
</MenuItem>
</NavLink>
</li>
<li>
<MenuItem to={RoutePaths.Source}>
<NavLink className={navLinkClassName} to={RoutePaths.Source}>
<SourceIcon />
<Text>
<FormattedMessage id="sidebar.sources" />
</Text>
</MenuItem>
</NavLink>
</li>
<li>
<MenuItem to={RoutePaths.Destination}>
<NavLink className={navLinkClassName} to={RoutePaths.Destination}>
<DestinationIcon />
<Text>
<FormattedMessage id="sidebar.destinations" />
</Text>
</MenuItem>
</NavLink>
</li>
</Menu>
</div>
<Menu>
<li>
<MenuItem to={CloudRoutes.Credits}>
<NavLink className={navLinkClassName} to={CloudRoutes.Credits}>
<CreditsIcon icon={faStar} />
<Text>
<FormattedNumber value={cloudWorkspace.remainingCredits} />
</Text>
</MenuItem>
</NavLink>
</li>
<li>
<SidebarPopout options={[{ value: "docs" }, { value: "slack" }, { value: "status" }, { value: "recipes" }]}>
{({ onOpen }) => (
<MenuItem onClick={onOpen} as="div">
{({ onOpen, isOpen }) => (
<div className={getPopoutStyles(isOpen)} onClick={onOpen}>
<DocsIcon />
<Text>
<FormattedMessage id="sidebar.resources" />
</Text>
</MenuItem>
</div>
)}
</SidebarPopout>
</li>
Expand All @@ -186,18 +166,18 @@ const SideBar: React.FC = () => {
},
]}
>
{({ onOpen }) => (
<MenuItem onClick={onOpen} as="div">
{({ onOpen, isOpen }) => (
<div className={getPopoutStyles(isOpen)} onClick={onOpen}>
<FontAwesomeIcon icon={faQuestionCircle} size="2x" />
<Text>
<FormattedMessage id="sidebar.support" />
</Text>
</MenuItem>
</div>
)}
</SidebarPopout>
</li>
<li>
<MenuItem to={RoutePaths.Settings}>
<NavLink className={navLinkClassName} to={RoutePaths.Settings}>
<WithFeature featureId={FeatureItem.AllowUpdateConnectors}>
<React.Suspense fallback={null}>
<NotificationIndicator />
Expand All @@ -207,7 +187,7 @@ const SideBar: React.FC = () => {
<Text>
<FormattedMessage id="sidebar.settings" />
</Text>
</MenuItem>
</NavLink>
</li>
</Menu>
</Bar>
Expand Down
2 changes: 2 additions & 0 deletions airbyte-webapp/src/scss/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
$transition: 0.3s;
$transition-out: all $transition ease-out;

$border-thin: 1px;
$border-thick: 2px;
Expand All @@ -13,3 +14,4 @@ $spacing-lg: 15px;
$spacing-xl: 20px;
$spacing-2xl: 40px;
$spacing-page-bottom: 150px;
$defaultBottomMargin: 150px;
teallarson marked this conversation as resolved.
Show resolved Hide resolved
55 changes: 55 additions & 0 deletions airbyte-webapp/src/views/layout/SideBar/SideBar.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
@use "../../../scss/colors";
@use "../../../scss/variables";

.menuItem {
color: colors.$grey-30;
width: 100%;
cursor: pointer;
border-radius: 12px;
height: 70px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-weight: normal;
font-size: 12px;
line-height: 15px;
margin-top: 7px;
text-decoration: none;
position: relative;

&:hover,
&:focus-visible {
background: colors.$dark-blue-800;
transition: variables.$transition-out;
}

&.active {
color: colors.$white;
background: colors.$blue-400;
transition: variables.$transition-out;

&:hover,
&:focus-visible {
color: colors.$white;
background: colors.$blue-300;
transition: variables.$transition-out;
}
}

&.activeChild {
color: colors.$white;
background: colors.$dark-blue-600;

&:hover,
&:focus-visible {
color: colors.$white;
background: colors.$dark-blue-400;
}
}

&.popoutOpen {
background: colors.$dark-blue-600;
transition: variables.$transition-out;
}
}
Loading