Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit ce15a9e

Browse files
author
Ronan Levesque
committed
Remove old classes in doc, rename Toggle > ToggleRefinement, fix a few visual bugs
1 parent 9dad90c commit ce15a9e

File tree

9 files changed

+67
-88
lines changed

9 files changed

+67
-88
lines changed

content/widgets/hierarchical-menu.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ classes:
118118
description: the root div of the widget
119119
- name: .ais-HierarchicalMenu--noRefinement
120120
description: the root div of the widget with no refinement
121-
- name: .ais-HierarchicalMenu-header
122-
description: the header of the widget (optional)
123-
- name: .ais-HierarchicalMenu-body
124-
description: the body of the widget
125121
- name: .ais-HierarchicalMenu-searchBox
126122
description: the search box of the widget
127123
- name: .ais-HierarchicalMenu-list
@@ -150,6 +146,4 @@ classes:
150146
description: the button used to display more categories
151147
- name: .ais-HierarchicalMenu-showMore--disabled
152148
description: the disabled button used to display more categories
153-
- name: .ais-HierarchicalMenu-footer
154-
description: the footer of the widget (optional)
155149
---

content/widgets/menu-select.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,8 @@ classes:
1313
description: the root div of the widget
1414
- name: .ais-MenuSelect--noRefinement
1515
description: the root div of the widget with no refinement
16-
- name: .ais-MenuSelect-header
17-
description: the header of the widget (optional)
18-
- name: .ais-MenuSelect-body
19-
description: the body of the widget
2016
- name: .ais-MenuSelect-select
2117
description: the select
2218
- name: .ais-MenuSelect-option
2319
description: the select option
24-
- name: .ais-MenuSelect-footer
25-
description: the footer of the widget (optional)
2620
---

content/widgets/toggle-refinement.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: ToggleRefinement
3+
type: widget
4+
html: |
5+
<div class="ais-ToggleRefinement">
6+
<ul class="ais-ToggleRefinement-list">
7+
<li class="ais-ToggleRefinement-item">
8+
<label class="ais-ToggleRefinement-label">
9+
<input class="ais-ToggleRefinement-checkbox" type="checkbox" value="Free Shipping" />
10+
<span class="ais-ToggleRefinement-labelText">Free Shipping</span>
11+
<span class="ais-ToggleRefinement-count">18,013</span>
12+
</label>
13+
</li>
14+
</ul>
15+
</div>
16+
classes:
17+
- name: .ais-ToggleRefinement
18+
description: the root div of the widget
19+
- name: .ais-ToggleRefinement-list
20+
description: the list of toggles
21+
- name: .ais-ToggleRefinement-item
22+
description: the toggle list item
23+
- name: .ais-ToggleRefinement-label
24+
description: the label of each toggle item
25+
- name: .ais-ToggleRefinement-checkbox
26+
description: the checkbox input of each toggle item
27+
- name: .ais-ToggleRefinement-labelText
28+
description: the label text of each toggle item
29+
- name: .ais-ToggleRefinement-count
30+
description: the count of items for each item
31+
---

content/widgets/toggle.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

layouts/partials/theme-selector.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<label>
33
<small>Choose a CSS theme:</small>
44
<select name="" id="js-changeTheme">
5-
<option value="/assets/css/{{ index .Site.Data.hashcss "reset.css" }}">Reset</option>
65
<option value="/assets/css/{{ index .Site.Data.hashcss "algolia.css" }}">Algolia</option>
6+
<option value="/assets/css/{{ index .Site.Data.hashcss "reset.css" }}">Reset</option>
77
<option value="">None</option>
88
</select>
99
</label>

layouts/partials/widgets-list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ <h3>Widgets:</h3>
2424
<li><a href="/widgets/snippet">Snippet</a></li>
2525
<li><a href="/widgets/sort-by">SortBy</a></li>
2626
<li><a href="/widgets/stats">Stats</a></li>
27-
<li><a href="/widgets/toggle">Toggle</a></li>
27+
<li><a href="/widgets/toggle-refinement">ToggleRefinement</a></li>
2828
</ul>
2929
</aside>

src/js/main.js

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,27 @@ import './highlight';
22

33
const changeThemeSelect = document.getElementById('js-changeTheme');
44
const customThemeStyleSheet = document.getElementById('js-customTheme');
5-
const localStorageTheme = localStorage.getItem('customTheme') || '';
5+
const localStorageSelectChoice = localStorage.getItem('selectChoice') || 0;
66
const hoverClass = document.querySelectorAll('.js-hoverClass');
77
const codeWrapperTabs = document.querySelectorAll('.code-wrapper-tab');
88

99
// Store current CSS theme in localStorage
1010

11-
customThemeStyleSheet.setAttribute('href', localStorageTheme);
11+
customThemeStyleSheet.setAttribute(
12+
'href',
13+
changeThemeSelect.options[localStorageSelectChoice].value
14+
);
1215

1316
if (changeThemeSelect) {
14-
changeThemeSelect.value = localStorageTheme;
15-
changeThemeSelect.addEventListener('change', () => {
16-
customThemeStyleSheet.setAttribute('href', changeThemeSelect.value);
17-
localStorage.setItem('customTheme', changeThemeSelect.value);
17+
changeThemeSelect.value =
18+
changeThemeSelect.options[localStorageSelectChoice].value;
19+
changeThemeSelect.addEventListener('change', e => {
20+
customThemeStyleSheet.setAttribute(
21+
'href',
22+
changeThemeSelect.options[e.target.options.selectedIndex].value
23+
);
24+
localStorage.setItem('selectChoice', e.target.options.selectedIndex);
1825
});
19-
20-
// FIXME
21-
// Used to avoid CSS errors when updating themes and reloading
22-
// Comment when comitting
23-
24-
// window.setTimeout(() => {
25-
// changeThemeSelect.value = changeThemeSelect.options[1].value;
26-
// customThemeStyleSheet.setAttribute(
27-
// 'href',
28-
// changeThemeSelect.options[1].value
29-
// );
30-
// }, 300);
3126
}
3227

3328
// Hover list of classes to highligh them

src/scss/themes/algolia.scss

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ a[class^='ais-'] {
2323
.ais-ClearRefinements,
2424
.ais-CurrentRefinements,
2525
.ais-HierarchicalMenu,
26-
.ais-Highlight,
2726
.ais-Hits,
2827
.ais-Results,
2928
.ais-HitsPerPage,
@@ -42,10 +41,9 @@ a[class^='ais-'] {
4241
.ais-RatingMenu,
4342
.ais-RefinementList,
4443
.ais-SearchBox,
45-
.ais-Snippet,
4644
.ais-SortBy,
4745
.ais-Stats,
48-
.ais-Toggle {
46+
.ais-ToggleRefinement {
4947
color: $port-gore;
5048
}
5149

@@ -203,7 +201,7 @@ a[class^='ais-'] {
203201
.ais-Menu-count,
204202
.ais-RatingMenu-count,
205203
.ais-RefinementList-count,
206-
.ais-Toggle-count {
204+
.ais-ToggleRefinement-count {
207205
font-size: 0.8rem;
208206

209207
&:before {
@@ -231,20 +229,6 @@ a[class^='ais-'] {
231229
background-color: $koromiko;
232230
}
233231

234-
.ais-InfiniteHits-header,
235-
.ais-InfiniteResults-header,
236-
.ais-Hits-header,
237-
.ais-Results-header {
238-
margin-bottom: 1rem;
239-
}
240-
241-
.ais-InfiniteHits-footer,
242-
.ais-InfiniteResults-footer,
243-
.ais-Hits-footer,
244-
.ais-Results-footer {
245-
margin-top: 1rem;
246-
}
247-
248232
.ais-InfiniteHits-list,
249233
.ais-InfiniteResults-list,
250234
.ais-Hits-list,
@@ -253,6 +237,10 @@ a[class^='ais-'] {
253237
margin-left: -1rem;
254238
display: flex;
255239
flex-wrap: wrap;
240+
241+
.ais-Panel-body & {
242+
margin: 0.5rem 0 0 -1rem;
243+
}
256244
}
257245

258246
.ais-InfiniteHits-item,
@@ -265,6 +253,10 @@ a[class^='ais-'] {
265253
width: calc(25% - 1rem);
266254
border: 1px solid $ghost;
267255
box-shadow: 0 2px 5px 0px lighten($ghost, 10%);
256+
257+
.ais-Panel-body & {
258+
margin: 0.5rem 0 0.5rem 1rem;
259+
}
268260
}
269261

270262
.ais-InfiniteHits-loadMore,
@@ -399,14 +391,18 @@ a[class^='ais-'] {
399391
border-color: darken($ghost, 20%);
400392
box-sizing: border-box;
401393
}
402-
}
403394

404-
.rheostat-handle {
405-
border-color: darken($ghost, 20%);
406-
}
395+
.rheostat-handle {
396+
border-color: darken($ghost, 20%);
397+
}
398+
399+
.rheostat-marker {
400+
background-color: darken($ghost, 20%);
401+
}
407402

408-
.rheostat-marker {
409-
background-color: darken($ghost, 20%);
403+
.ais-Panel-body & {
404+
margin: 2rem 0;
405+
}
410406
}
411407

412408
.ais-RatingMenu-count,

src/scss/themes/reset.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
.ais-Pagination-list,
1313
.ais-RatingMenu-list,
1414
.ais-RefinementList-list,
15-
.ais-Toggle-list {
15+
.ais-ToggleRefinement-list {
1616
margin: 0;
1717
padding: 0;
1818
list-style: none;

0 commit comments

Comments
 (0)