Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
24 changes: 17 additions & 7 deletions packages/site_shared/lib/_sass/components/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ button {
padding: 0.4rem 0.9rem;
text-decoration: none;
cursor: pointer;

&:disabled {
cursor: default;
opacity: 0.5;
}
}

&.compact-button {
gap: 0.2rem;
padding: 0.25rem 0.65rem;
}

&.filled-button {
Expand All @@ -52,23 +62,23 @@ button {
font-size: 20px;
}

&:hover {
&:not(:disabled):hover {
@include mixins.interaction-style(8%);
}

&:active {
&:not(:disabled):active {
@include mixins.interaction-style(16%);
}
}

&.text-button {
color: var(--site-primary-color);

&:hover {
&:not(:disabled):hover {
@include mixins.interaction-style(4%);
}

&:active {
&:not(:disabled):active {
@include mixins.interaction-style(8%);
}
}
Expand All @@ -77,11 +87,11 @@ button {
color: var(--site-primary-color);
border: 1px solid var(--site-primary-color);

&:hover {
&:not(:disabled):hover {
@include mixins.interaction-style(4%);
}

&:active {
&:not(:disabled):active {
@include mixins.interaction-style(8%);
}
}
Expand All @@ -103,7 +113,7 @@ button {
font-size: 1.75rem;
}

&:hover {
&:not(:disabled):hover {
color: var(--site-base-fgColor);
}
}
Expand Down
6 changes: 6 additions & 0 deletions packages/site_shared/lib/components/common/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Button extends StatelessComponent {
this.href,
this.content,
this.style = ButtonStyle.text,
this.size = ButtonSize.regular,
this.id,
this.attributes = const {},
this.classes,
Expand All @@ -30,6 +31,7 @@ class Button extends StatelessComponent {
final String? content;
final String? title;
final ButtonStyle style;
final ButtonSize size;
final String? icon;
final String? trailingIcon;
final String? id;
Expand All @@ -50,6 +52,7 @@ class Button extends StatelessComponent {

final mergedClasses = [
style.cssClass,
if (size == ButtonSize.compact) 'compact-button',
if ((icon != null || trailingIcon != null) && content == null)
'icon-button',
...?classes,
Expand Down Expand Up @@ -83,6 +86,9 @@ class Button extends StatelessComponent {
}
}

/// The amount of space used within a [Button].
enum ButtonSize { regular, compact }

enum ButtonStyle {
filled,
outlined,
Expand Down
1 change: 1 addition & 0 deletions sites/docs/lib/_sass/_site.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@use 'components/content';
@use 'components/expansion-list';
@use 'components/filter-search';
@use 'components/filterable-index';
@use 'components/footer';
@use 'components/header';
@use 'components/icons';
Expand Down
203 changes: 203 additions & 0 deletions sites/docs/lib/_sass/components/_filterable-index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
// The markup comes from the `FiltersSidebar` and `FilterSearchGroup`
// components in `filterable_index.dart`, so everything here is keyed off
// classes. Each page styles its own results list separately, keyed off the
// id of that list.

.filterable-index {
Comment thread
ericwindmill marked this conversation as resolved.
$mobile-breakpoint: 839px;
$sidebar-width: 220px;

display: flex;
flex-direction: row;

.left-col {
margin-right: 1rem;
flex: 2;
}

.right-col {
width: $sidebar-width;
}

// The sidebar follows the page as it scrolls on wide screens and stays within
// the viewport. On narrow screens, it becomes an off-canvas drawer.
.filter-sidebar {
position: sticky;
top: calc(var(--site-header-height) + 1rem);
display: flex;
flex-direction: column;
max-height: calc(100vh - var(--site-header-height) - 2rem);
}

.filter-group-wrapper {
// Scroll expanded filters independently so any sidebar footer stays visible.
min-height: 0;
border: 1px solid var(--site-inset-borderColor);
background-color: var(--site-inset-bgColor);
border-radius: var(--site-radius);
overflow-x: hidden;
overflow-y: auto;
overscroll-behavior: none;
}

// Keep the title visible while the filters scroll. The close control is only
// shown while the sidebar is a drawer.
.filter-header {
position: sticky;
top: 0;
z-index: 1;
display: grid;
grid-template-columns: 2.25rem 1fr 2.25rem;
align-items: center;
background-color: var(--site-raised-bgColor);
border-bottom: 1px solid var(--site-inset-borderColor);

.table-title {
grid-column: 2;
padding: .5rem 0;
text-align: center;
color: var(--site-base-fgColor-alt);
font-family: var(--site-ui-fontFamily);
font-weight: 600;
font-size: .925rem;
}

.close-icon {
display: none;
grid-column: 3;
align-items: center;
justify-self: center;
cursor: pointer;
padding: 0.25rem;
border-radius: 4px;
background: none;
border: none;
color: var(--site-base-fgColor-alt);
transition: background-color 0.2s ease, color 0.2s ease;

&:hover {
background-color: rgba(0, 0, 0, 0.1);
color: var(--site-primary-color);
}

.material-symbols {
font-size: 20px;
}
}
}

.filter-group {
.table-content {
padding: 1rem;
}

ul {
padding-left: 0;
margin-bottom: .5rem;

li {
list-style: none;
padding-left: 0;
padding-bottom: .25rem;
display: flex;
align-items: center;

label {
padding-left: .35rem;
font-size: .9rem;
}
}
}

h4 {
margin: 0 0 .5rem;
padding: 0;
}

.filter-expansion-button {
margin-bottom: 1rem;
}

.hidden {
display: none;
}
}

.filter-search-group {
display: flex;
flex-direction: column;

button.show-filters-button {
@media (min-width: $mobile-breakpoint + 1) {
display: none;
}
}

.label-row {
display: flex;
justify-content: space-between;
font-size: .925rem;
margin-top: .25rem;

label {
font-family: var(--site-ui-fontFamily);
color: var(--site-base-fgColor-lighter);

margin: 0 .5rem 0 0;
text-align: end;
}
}
}

// On narrow screens the sidebar becomes a drawer that slides in from the
// right. Opening and closing is driven entirely by the hidden
// `.filter-drawer-toggle` checkbox that precedes it.
@media (max-width: $mobile-breakpoint) {
flex-direction: column;

.left-col {
margin-right: 0;
}

// The drawer itself is fixed-positioned, so this column no longer needs to
// reserve width for it in the flex layout.
.right-col {
width: auto;
}

.filter-header {
.close-icon {
display: flex;
}
}

.filter-sidebar {
position: fixed;
top: var(--site-header-height);
bottom: 0;
right: -$sidebar-width;
width: $sidebar-width;
max-height: none;
display: flex;
flex-direction: column;
background-color: var(--site-inset-bgColor);
border-left: 1px solid var(--site-inset-borderColor);
transition: right 0.3s ease-in-out;
z-index: var(--site-z-top);
}

.filter-drawer-toggle:checked + .filter-sidebar {
right: 0;
}

// Fill the drawer rather than floating within it as a card,
// and scroll on its own so any footer stays in view.
.filter-group-wrapper {
flex: 1;
min-height: 0;
overflow-y: auto;
border: none;
border-radius: 0;
}
}
}
Loading
Loading