-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(issues): Hide event details headers for cron issues (#80568)
- Loading branch information
Showing
9 changed files
with
120 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
static/app/views/issueDetails/streamline/toggleSidebar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
import {Button} from 'sentry/components/button'; | ||
import {IconChevron} from 'sentry/icons/iconChevron'; | ||
import {t} from 'sentry/locale'; | ||
import {space} from 'sentry/styles/space'; | ||
import {useSyncedLocalStorageState} from 'sentry/utils/useSyncedLocalStorageState'; | ||
|
||
export function ToggleSidebar({size = 'lg'}: {size?: 'lg' | 'sm'}) { | ||
const [sidebarOpen, setSidebarOpen] = useSyncedLocalStorageState( | ||
'issue-details-sidebar-open', | ||
true | ||
); | ||
const direction = sidebarOpen ? 'right' : 'left'; | ||
return ( | ||
<ToggleContainer | ||
sidebarOpen={sidebarOpen} | ||
style={{paddingTop: size === 'lg' ? '4px' : '0px'}} | ||
> | ||
<ToggleButton | ||
onClick={() => setSidebarOpen(!sidebarOpen)} | ||
aria-label={sidebarOpen ? t('Close Sidebar') : t('Open Sidebar')} | ||
style={{height: size === 'lg' ? '30px' : '26px'}} | ||
analyticsEventKey="issue_details.sidebar_toggle" | ||
analyticsEventName="Issue Details: Sidebar Toggle" | ||
analyticsParams={{ | ||
sidebar_open: !sidebarOpen, | ||
}} | ||
> | ||
<LeftChevron direction={direction} /> | ||
<RightChevron direction={direction} /> | ||
</ToggleButton> | ||
</ToggleContainer> | ||
); | ||
} | ||
|
||
const ToggleContainer = styled('div')<{sidebarOpen: boolean}>` | ||
width: ${p => (p.sidebarOpen ? '30px' : '50px')}; | ||
position: relative; | ||
@media (max-width: ${p => p.theme.breakpoints.large}) { | ||
display: none; | ||
} | ||
`; | ||
|
||
// The extra 1px on width is to display above the sidebar border | ||
const ToggleButton = styled(Button)` | ||
border-radius: ${p => p.theme.borderRadiusLeft}; | ||
border-right-color: ${p => p.theme.background} !important; | ||
box-shadow: none; | ||
position: absolute; | ||
padding: 0; | ||
left: ${space(0.5)}; | ||
width: calc(100% - ${space(0.5)} + 1px); | ||
outline: 0; | ||
min-height: unset; | ||
`; | ||
|
||
const LeftChevron = styled(IconChevron)` | ||
position: absolute; | ||
color: ${p => p.theme.subText}; | ||
height: 10px; | ||
width: 10px; | ||
left: ${space(0.75)}; | ||
`; | ||
|
||
const RightChevron = styled(LeftChevron)` | ||
left: ${space(1.5)}; | ||
`; |