Skip to content

Commit 821e8f0

Browse files
DEV: Refactor (#90)
1 parent 4607dbb commit 821e8f0

File tree

3 files changed

+33
-136
lines changed

3 files changed

+33
-136
lines changed

common/common.scss

Lines changed: 9 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
@import "common/foundation/mixins";
2-
3-
$max-width: 600px;
1+
// these are add-on styles controlled by settings
2+
@import "special-styles";
43

5-
.welcome-banner {
4+
.welcome-banner:not(.below-site-header-outlet, .above-main-container-outlet),
5+
.header-search--enabled .floating-search-input-wrapper,
6+
.search-header--visible .floating-search-input-wrapper {
67
display: none;
78
}
89

9-
.display-search-banner {
10-
#main-outlet {
11-
padding-top: 0;
12-
}
13-
}
14-
1510
.search-banner {
1611
background-image: var(--custom-bg);
1712

@@ -23,71 +18,7 @@ $max-width: 600px;
2318
}
2419
}
2520

26-
// hide search icon from default search menu
27-
.search-menu.glimmer-search-menu .search-icon {
28-
display: none;
29-
}
30-
31-
.custom-search-banner-wrap {
32-
box-sizing: border-box;
33-
position: relative;
34-
padding: 2.5em 0 3em;
35-
margin: 1em auto;
36-
37-
@include breakpoint(tablet) {
38-
padding: 1em 8px 1.25em;
39-
margin-top: 0.5em;
40-
}
41-
42-
> div {
43-
margin: 0 auto;
44-
max-width: $max-width;
45-
}
46-
47-
.search-menu {
48-
display: flex;
49-
position: relative;
50-
51-
.search-menu-container {
52-
width: 100%;
53-
min-width: 0;
54-
}
55-
}
56-
57-
.menu-panel-results .menu-panel {
58-
position: unset;
59-
padding: 0;
60-
}
61-
62-
.d-icon-search {
63-
margin: 0;
64-
}
65-
66-
.browser-search-tip {
67-
display: none;
68-
}
69-
70-
.search-input {
71-
input.search-term__input {
72-
min-width: 0;
73-
flex: 1 1;
74-
}
75-
}
76-
77-
h1 {
78-
font-size: var(--font-up-6);
79-
line-height: $line-height-medium;
80-
81-
@include breakpoint(tablet) {
82-
font-size: var(--font-up-4);
83-
}
84-
}
85-
86-
h1,
87-
p {
88-
text-align: center;
89-
}
90-
21+
.welcome-banner {
9122
.btn.search-icon:not(.has-search-button-text) {
9223
z-index: 2;
9324
background: transparent;
@@ -128,58 +59,20 @@ $max-width: 600px;
12859
}
12960

13061
.btn.search-icon.has-search-button-text {
131-
order: 2;
13262
margin-left: 0.5em;
13363
column-gap: 0.5em;
13464
background-color: var(--tertiary);
13565
color: var(--secondary);
136-
flex: none;
66+
position: unset;
67+
height: unset;
13768

13869
&:hover {
13970
background-color: var(--tertiary-hover);
71+
color: var(--secondary);
14072
}
14173

14274
.d-icon {
14375
color: var(--secondary);
14476
}
14577
}
146-
147-
.results {
148-
box-sizing: border-box;
149-
background: var(--secondary);
150-
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
151-
position: absolute;
152-
z-index: 9;
153-
margin-left: auto;
154-
margin-right: auto;
155-
left: 0;
156-
top: 2.75em;
157-
right: 0;
158-
padding: 0.5em;
159-
160-
@include breakpoint(mobile-extra-large) {
161-
width: 100%;
162-
}
163-
164-
ul,
165-
ol {
166-
list-style-type: none;
167-
margin: 0;
168-
}
169-
170-
.d-icon-search {
171-
display: none;
172-
}
173-
}
174-
175-
.search-link .d-icon {
176-
color: var(--primary-medium);
177-
}
178-
179-
span.keyword {
180-
color: var(--primary);
181-
}
18278
}
183-
184-
// these are add-on styles controlled by settings
185-
@import "special-styles";

javascripts/discourse/components/search-banner.hbs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{{#if this.shouldDisplay}}
22
<div
3-
class="{{concat (theme-setting 'plugin_outlet') '-outlet'}} search-banner"
3+
class="{{concat (theme-setting 'plugin_outlet') '-outlet'}}
4+
search-banner welcome-banner"
45
>
56
<div
6-
class="custom-search-banner"
7+
class="custom-search-banner welcome-banner__inner-wrapper"
78
{{did-insert this.didInsert}}
89
{{will-destroy this.willDestroy}}
910
>
10-
<div class="wrap custom-search-banner-wrap">
11+
<div class="custom-search-banner-wrap welcome-banner__wrap">
1112
<h1>{{html-safe (theme-i18n "search_banner.headline")}}</h1>
1213
<PluginOutlet @name="search-banner-below-headline" />
1314
<p>{{html-safe (theme-i18n "search_banner.subhead")}}</p>
14-
<div class="search-menu">
15+
<div class="search-menu welcome-banner__search-menu">
1516
{{#unless this.buttonText}}
1617
<SearchIcon />
1718
{{/unless}}

stylesheets/special-styles.scss

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
@if $special-style == "big search, no text" {
2+
.welcome-banner {
3+
margin-bottom: 0;
4+
}
5+
6+
.above-main-container-outlet .custom-search-banner-wrap {
7+
padding: 0 0 1em 0;
8+
}
9+
210
.custom-search-banner-wrap {
3-
padding: 0;
11+
padding: 1em;
412

513
@if $background-image-light != "" {
614
background-image: var(--custom-bg);
@@ -14,6 +22,13 @@
1422
.results {
1523
max-width: unset;
1624
width: 100%;
25+
font-size: var(--font-down-3);
26+
top: 3.45em;
27+
padding: 0;
28+
29+
.search-result-topic .first-line {
30+
font-size: var(--font-up-1);
31+
}
1732
}
1833

1934
.search-context {
@@ -31,16 +46,6 @@
3146
max-width: unset;
3247
}
3348

34-
.results {
35-
font-size: var(--font-down-3);
36-
top: 3.45em;
37-
padding: 0;
38-
39-
.search-result-topic .first-line {
40-
font-size: var(--font-up-1);
41-
}
42-
}
43-
4449
.blurb {
4550
font-size: var(--font-down-2);
4651
max-width: 600px;
@@ -61,6 +66,7 @@
6166
.search-menu-recent {
6267
font-size: var(--font-down-1);
6368
margin-top: 0;
69+
6470
li:last-child {
6571
.search-link {
6672
margin-bottom: 0;
@@ -74,7 +80,7 @@
7480
}
7581

7682
.no-results {
77-
padding: 1em;
83+
padding: 1em !important;
7884
}
7985

8086
.results > * {
@@ -100,6 +106,7 @@
100106

101107
.show-more {
102108
margin-top: 0.33em;
109+
103110
.search-link {
104111
margin-bottom: 0;
105112
}
@@ -113,9 +120,5 @@
113120
.search-input .searching {
114121
top: 0.45em;
115122
}
116-
117-
.no-results {
118-
padding: 1em !important;
119-
}
120123
}
121124
}

0 commit comments

Comments
 (0)