Skip to content

Commit 45ce583

Browse files
authored
fix(ui): make close button in drawer transparent (#95330)
paddings are aligned taking the internal button padding into account: <img width="1015" height="252" alt="Screenshot 2025-07-11 at 15 57 07" src="https://github.com/user-attachments/assets/a9a73cd6-bf77-461f-876e-79d95eabc6dc" /> Biggest difference is now that the button has a more prominent text color, as I’ve removed all custom color overwrites. It’s just a standard `transparent` button now | before | after | |--------|--------| | <img width="1137" height="252" alt="Screenshot 2025-07-11 at 15 53 26" src="https://github.com/user-attachments/assets/871c71ec-99bc-4853-bb34-a58577b2e549" /> | <img width="1015" height="252" alt="Screenshot 2025-07-11 at 15 56 15" src="https://github.com/user-attachments/assets/c182e4f8-a595-4b1a-8293-0ed3b440be4b" /> | | <img width="1137" height="252" alt="Screenshot 2025-07-11 at 15 53 48" src="https://github.com/user-attachments/assets/61b4ce12-9fea-4246-a415-48766c773041" /> | <img width="1137" height="252" alt="Screenshot 2025-07-11 at 15 52 17" src="https://github.com/user-attachments/assets/6cd5c43f-1997-419a-b3c8-b88e571937af" /> |
1 parent fabf2ca commit 45ce583

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

static/app/components/globalDrawer/components.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,23 @@ export function DrawerHeader({
129129
const {onClose} = useDrawerContentContext();
130130

131131
return (
132-
<Header ref={ref} className={className}>
132+
<Header
133+
ref={ref}
134+
className={className}
135+
hideCloseButton={hideCloseButton}
136+
hideBar={hideBar}
137+
>
133138
{!hideCloseButton && (
134139
<Fragment>
135-
<CloseButton
136-
priority="link"
140+
<Button
141+
priority="transparent"
137142
size="xs"
138-
borderless
139143
aria-label={t('Close Drawer')}
140144
icon={<IconClose />}
141145
onClick={onClose}
142146
>
143147
{t('Close')}
144-
</CloseButton>
148+
</Button>
145149
{!hideBar && <HeaderBar />}
146150
</Fragment>
147151
)}
@@ -150,28 +154,25 @@ export function DrawerHeader({
150154
);
151155
}
152156

153-
const CloseButton = styled(Button)`
154-
color: ${p => p.theme.subText};
155-
&:hover {
156-
color: ${p => p.theme.textColor};
157-
}
158-
`;
159-
160157
const HeaderBar = styled('div')`
161158
margin: 0 ${space(2)};
159+
margin-left: ${space(1)};
162160
border-right: 1px solid ${p => p.theme.border};
163161
`;
164162

165-
const Header = styled('header')`
163+
const Header = styled('header')<{hideBar?: boolean; hideCloseButton?: boolean}>`
166164
position: sticky;
167165
top: 0;
168166
z-index: ${p => p.theme.zIndex.drawer + 1};
169167
background: ${p => p.theme.background};
170168
justify-content: flex-start;
171169
display: flex;
170+
gap: ${p => (p.hideBar ? space(1) : 0)};
172171
padding: ${space(1.5)};
173172
box-shadow: ${p => p.theme.border} 0 1px;
174-
padding-left: 24px;
173+
padding-left: ${p => (p.hideCloseButton ? '24px' : space(2))};
174+
padding-top: ${p => (p.hideCloseButton ? space(1.5) : space(0.75))};
175+
padding-bottom: ${p => (p.hideCloseButton ? space(1.5) : space(0.75))};
175176
`;
176177

177178
export const DrawerBody = styled('aside')`

0 commit comments

Comments
 (0)