Skip to content

Commit

Permalink
remove console logs, move styles
Browse files Browse the repository at this point in the history
  • Loading branch information
nhsiehgit committed Aug 27, 2024
1 parent cfc46e4 commit acb7f10
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 32 deletions.
3 changes: 0 additions & 3 deletions static/app/components/sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,6 @@ function Sidebar() {

// Sidebar accordion includes a secondary list of nav items
// TODO: replace with a secondary panel
// Bugs:
// - on click highlights the card... but deselect doesn't un-highlight
//
const explore = (
<SidebarAccordion
{...sidebarItemProps}
Expand Down
7 changes: 1 addition & 6 deletions static/app/components/sidebar/sidebarAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,15 @@ function SidebarAccordion({
if ((!horizontal && !sidebarCollapsed) || !children) {
setExpandedItemId(null);
if (!hasMainLink) {
console.log('SETTING EXPANDED TO NULL');
setExpanded(!expanded);
}
return;
}

e.preventDefault();
if (isOpenInFloatingSidebar) {
console.log('SETTING EXPANDED TO NULL');
setExpandedItemId(null);
} else {
console.log('SETTING EXPANDED TO: ', mainItemId);
setExpandedItemId(mainItemId);
}
};
Expand All @@ -118,10 +115,7 @@ function SidebarAccordion({

let isMainItemActive = isActive && !hasActiveChildren;
if (shouldAccordionFloat) {
console.log('ACCORDION SHOULD FLOAT');
console.log('IS ACTIVE: ', isActive);
isMainItemActive = isActive || hasActiveChildren;
console.log('IS MAIN ITEM ACTIVE: ', isMainItemActive);
}

return (
Expand Down Expand Up @@ -173,6 +167,7 @@ function SidebarAccordion({
isMainItem
/>
{childrenWithProps}
<div>IS OPEN AND HORIZONTAL OR COLLAPSED</div>
</StyledOverlay>
)}
</SidebarAccordionWrapper>
Expand Down
40 changes: 17 additions & 23 deletions static/app/components/sidebar/sidebarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ function SidebarItem({
const isInCollapsedState = (!isInFloatingAccordion && collapsed) || hasNewNav;

const isActive = defined(active) ? active : isActiveRouter;
if (isActive) {
console.log('SIDEBAR ITEM IS ACTIVE: ', id);
}
const isTop = orientation === 'top' && !isInFloatingAccordion;
const placement = isTop ? 'bottom' : 'right';

Expand Down Expand Up @@ -375,9 +372,6 @@ const getActiveStyle = ({
`;
};

// height: ${16 * 2 + 40}px;
// width: 70px;

const StyledSidebarItem = styled(Link, {
shouldForwardProp: p => typeof p === 'string' && isPropValid(p),
})`
Expand All @@ -386,31 +380,31 @@ const StyledSidebarItem = styled(Link, {
position: relative;
cursor: pointer;
font-size: 15px;
height: ${p => (p.isInFloatingAccordion ? '35px' : '30px')};
height: ${p =>
p.isInFloatingAccordion ? '35px' : p.hasNewNav ? `${16 * 2 + 40}px` : '30px'};
width: ${p => (p.isInFloatingAccordion ? '100%' : p.hasNewNav ? '70px' : 'auto')};
flex-shrink: 0;
border-radius: ${p => p.theme.borderRadius};
transition: none;
${p => {
if (!p.hasNewNav) {
if (p.hasNewNav && !p.isInFloatingAccordion) {
return css`
&:before {
display: block;
content: '';
position: absolute;
top: 4px;
left: calc(-${space(2)} - 1px);
bottom: 6px;
width: 5px;
border-radius: 0 3px 3px 0;
background-color: transparent;
transition: 0.15s background-color linear;
}
align-self: center;
`;
}
return css`
width: 70px;
height: ${16 * 2 + 40}px;
align-self: center;
&:before {
display: block;
content: '';
position: absolute;
top: 4px;
left: calc(-${space(2)} - 1px);
bottom: 6px;
width: 5px;
border-radius: 0 3px 3px 0;
background-color: transparent;
transition: 0.15s background-color linear;
}
`;
}}
Expand Down

0 comments on commit acb7f10

Please sign in to comment.