Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/react/css/src/algolia.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@import url('breadcrumbs.css');
@import url('hierarchical-menu.css');
@import url('refinement-list.css');
@import url('toggle-refinement.css');
@import url('panel.css');
@import url('pagination.css');
@import url('hits-per-page.css');
Expand Down
44 changes: 44 additions & 0 deletions examples/react/css/src/toggle-refinement.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.ais-ToggleRefinement-label {
font-size: 0.875rem;
line-height: 1.75rem;
display: block;
cursor: pointer;
flex-direction: row-reverse;
justify-content: space-between;
align-items: center;
display: flex;
}

input[class^='ais-'][class*='ToggleRefinement-checkbox'] {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we need such selector, why not target .ais-ToggleRefinement-checkbox?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because there is a selector in common.css that is of higher specificity input[class^='ais-'][type='checkbox']:checked { /* ... */ }

I did it this way because we were out of time so just needed something quick that would work but the class above probably needs to be merged into the refinement-list.css

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sarahdayan I have re-worked so it uses the default class name .ais-ToggleRefinement-checkbox

appearance: none;
height: 18px;
pointer-events: none;
width: 32px;
position: relative;
border: 1px solid rgba(var(--ais-border-color-rgb), 0.3);
background-color: rgb(var(--ais-background-color-rgb));
border-radius: calc(infinity * 1px);

&:checked {
background-image: none;
}
}

.ais-ToggleRefinement-checkbox::after {
appearance: none;
content: '';
width: var(--ais-spacing);
height: var(--ais-spacing);
position: absolute;
top: 0;
left: 0;
background: rgb(var(--ais-muted-color-rgb));
border-radius: calc(infinity * 1px);
transition: var(--ais-transition-duration)
var(--ais-transition-timing-function);
}

.ais-ToggleRefinement-checkbox:checked::after {
transform: translateX(14px);
background-color: rgb(var(--ais-background-color-rgb));
}