Skip to content

Commit 5892e9e

Browse files
authored
UX: stick new question button to top of mobile sidebar (#1329)
1 parent a49ed0c commit 5892e9e

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

assets/javascripts/discourse/components/ai-bot-sidebar-new-conversation.gjs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ export default class AiBotSidebarNewConversation extends Component {
2222

2323
<template>
2424
{{#if this.shouldRender}}
25-
<DButton
26-
@label="discourse_ai.ai_bot.conversations.new"
27-
@icon="plus"
28-
@action={{this.routeTo}}
29-
class="ai-new-question-button btn-default"
30-
/>
25+
<div class="ai-new-question-button__wrapper">
26+
<DButton
27+
@label="discourse_ai.ai_bot.conversations.new"
28+
@icon="plus"
29+
@action={{this.routeTo}}
30+
class="ai-new-question-button btn-default"
31+
/>
32+
</div>
3133
{{/if}}
3234
</template>
3335
}

assets/stylesheets/modules/ai-bot-conversations/common.scss

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@
77

88
body.has-ai-conversations-sidebar {
99
.ai-new-question-button {
10-
margin: 1.8em 1rem 0;
10+
width: 100%;
11+
12+
&__wrapper {
13+
background: var(--secondary);
14+
margin: 1.8em 1em 0;
15+
16+
.mobile-view & {
17+
padding: 1em;
18+
position: sticky;
19+
top: 0;
20+
margin: -0.5em 0 0; // avoid shift when sticking
21+
z-index: 1;
22+
}
23+
}
1124
}
1225

1326
.sidebar-toggle-all-sections {
@@ -16,10 +29,6 @@ body.has-ai-conversations-sidebar {
1629

1730
.sidebar-wrapper,
1831
.hamburger-dropdown-wrapper {
19-
.ai-conversations-panel {
20-
padding-top: 1em;
21-
}
22-
2332
// ai related sidebar content
2433
[data-section-name="ai-conversations-history"] {
2534
.sidebar-section-header-wrapper {

0 commit comments

Comments
 (0)