-
Notifications
You must be signed in to change notification settings - Fork 3.5k
CUJ index [land silently] #13769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ericwindmill
wants to merge
24
commits into
main
Choose a base branch
from
cuj-index
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
CUJ index [land silently] #13769
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
33ddc5b
refactor: generalize filterable index layout and components
ericwindmill ebee399
cleaup
ericwindmill fe9e250
feat(docs): add Critical User Journeys (CUJ) catalog and index page
ericwindmill 022086e
Merge remote-tracking branch 'origin/main' into cuj-index
parlough 5362d74
Use 2026 license headers
parlough 406ca7b
Group cuj-specific components
parlough bfead4c
Apply cleanup similar to learning resources index
parlough 6eba012
Misc clean up and basic API docs
parlough a8956d2
Standardize various tags, pills, and chips
parlough 6266e09
Merge branch 'main' into feat/consolidated-tags
parlough 10e4baf
Merge branch 'main' of https://github.com/flutter/website into cuj-index
ericwindmill 761d026
Merge commit 'refs/pull/13804/head' of https://github.com/flutter/web…
ericwindmill eedb3a7
Merge branch 'main' of https://github.com/flutter/website into cuj-index
ericwindmill bf666ec
use Tag class
ericwindmill b831c6d
remove unneeded file
ericwindmill 51289ee
Update sites/docs/lib/src/components/pages/cuj/cuj_filters.dart
ericwindmill b4619e5
Update sites/docs/lib/src/components/pages/cuj/cuj_filters_sidebar.dart
ericwindmill 4d2c846
Merge branch 'main' of https://github.com/flutter/website into cuj-index
ericwindmill d27116a
Merge branch 'cuj-index' of https://github.com/flutter/website into c…
ericwindmill a4f01fb
Apply batched suggestions from code review
ericwindmill 922970b
Merge branch 'cuj-index' of https://github.com/flutter/website into c…
ericwindmill 2b59513
address PR suggestions to content
ericwindmill 34c640f
Merge branch 'main' of https://github.com/flutter/website into cuj-index
ericwindmill b9f4201
Merge branch 'main' of https://github.com/flutter/website into cuj-index
ericwindmill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| @use '../components/filterable-index'; | ||
|
|
||
| $font-size-sm: 0.875rem; | ||
| $font-size-xl: 1.5rem; | ||
| $spacing-xs: 0.25rem; | ||
| $spacing-sm: 0.5rem; | ||
| $spacing-md: 1rem; | ||
| $spacing-lg: 1.5rem; | ||
| $transition-normal: 0.2s ease; | ||
|
|
||
| // The critical user journey index reuses the two column layout, search field, | ||
| // and filter sidebar of the learning resources index, which are styled in | ||
| // `_filterable-index.scss`. | ||
| // | ||
| // The journeys themselves render as full-width expandable cards, following | ||
| // the glossary in `_glossary.scss`. Expanding and collapsing is wired up | ||
| // by the `_setUpExpandableCards` global script. | ||
|
|
||
| // The feedback button is the sidebar footer, so it sits below the filter card | ||
| // and slides in with it when the sidebar becomes a drawer. | ||
| .cuj-feedback { | ||
| margin-block-start: $spacing-md; | ||
|
|
||
| .outlined-button { | ||
| width: 100%; | ||
| justify-content: center; | ||
| } | ||
|
|
||
| @media (max-width: filterable-index.$mobile-breakpoint) { | ||
| margin-block-start: 0; | ||
| padding: 0.75rem; | ||
| border-block-start: 1px solid var(--site-inset-borderColor); | ||
| } | ||
| } | ||
|
|
||
| #all-cujs-list { | ||
| margin-block-start: $spacing-md; | ||
|
|
||
| .cuj-card { | ||
| padding: 0.75rem $spacing-md; | ||
| gap: $spacing-xs; | ||
|
|
||
| .card-header { | ||
| display: flex; | ||
| flex-direction: row; | ||
| justify-content: space-between; | ||
| align-items: flex-start; | ||
| gap: $spacing-sm; | ||
| } | ||
|
|
||
| .cuj-card-heading { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: flex-start; | ||
| gap: 0.4rem; | ||
| // Allow long goals to wrap instead of widening the flex item. | ||
| min-width: 0; | ||
| } | ||
|
|
||
| .card-title { | ||
| display: block; | ||
| margin: 0; | ||
| font-family: var(--site-ui-fontFamily); | ||
| font-size: 1.1rem; | ||
| font-weight: 500; | ||
| line-height: 1.35; | ||
| text-wrap: pretty; | ||
| } | ||
|
|
||
| .card-header-buttons { | ||
| display: flex; | ||
| flex-direction: row; | ||
| align-items: center; | ||
| gap: $spacing-xs; | ||
| flex-shrink: 0; | ||
|
|
||
| .icon-button { | ||
| border-radius: $spacing-lg; | ||
|
|
||
| > span { | ||
| font-size: $font-size-xl; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| .cuj-task-count { | ||
| margin: 0; | ||
| font-size: $font-size-sm; | ||
| color: var(--site-base-fgColor-lighter); | ||
| } | ||
|
|
||
| // The shared card styles lay `.card-content` out as a centered row. | ||
| // Journeys need a plain block so the task list stacks below the divider. | ||
| .card-content { | ||
| display: block; | ||
| border-block-start: 0.05rem solid var(--site-inset-borderColor); | ||
| margin-block-start: $spacing-sm; | ||
| padding-block-start: $spacing-sm; | ||
| } | ||
|
|
||
| &.collapsed { | ||
| .card-content { | ||
| display: none; | ||
| } | ||
|
|
||
| .expand-button { | ||
| transform: rotate(180deg); | ||
| } | ||
| } | ||
|
|
||
| .expand-button { | ||
| transition: transform $transition-normal; | ||
|
|
||
| @media (prefers-reduced-motion: reduce) { | ||
| transition: none; | ||
| } | ||
| } | ||
|
|
||
| .cuj-task-list { | ||
| margin: 0; | ||
| padding-inline-start: 1.15rem; | ||
|
|
||
| li { | ||
| padding-inline-start: 0; | ||
| margin-block-end: $spacing-sm; | ||
| font-size: $font-size-sm; | ||
| line-height: 1.45; | ||
| color: var(--site-base-fgColor-lighter); | ||
|
|
||
| &:last-child { | ||
| margin-block-end: 0; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 138 additions & 0 deletions
138
sites/docs/lib/src/components/pages/cuj/cuj_filters.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| // Copyright 2026 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:jaspr/dom.dart'; | ||
| import 'package:jaspr/jaspr.dart'; | ||
| import 'package:site_shared/components/common/button.dart'; | ||
| import 'package:universal_web/web.dart' as web; | ||
|
|
||
| import '../../../models/cuj_model.dart'; | ||
| import '../filterable_index.dart'; | ||
| import 'cuj_filters_sidebar.dart'; | ||
|
|
||
| /// The id of the search field, so its result count can label it. | ||
| const _searchId = 'cuj-search'; | ||
|
|
||
| /// The search controls and result summary for the critical user journey index. | ||
| @client | ||
| class CujFilters extends StatefulComponent { | ||
| const CujFilters({super.key}); | ||
|
|
||
| /// The ID of the checkbox that toggles the filter drawer on narrow screens. | ||
| static const String drawerToggleId = 'cuj-filter-toggle'; | ||
|
|
||
| @override | ||
| State<CujFilters> createState() => _CujFiltersState(); | ||
| } | ||
|
|
||
| class _CujFiltersState extends State<CujFilters> { | ||
| /// The filters selected in the critical user journey sidebar. | ||
| static CujFiltersNotifier get _filters => CujFiltersSidebar.filters; | ||
|
|
||
| /// The journeys reconstructed from the rendered journey cards. | ||
| final List<Cuj> _cujs = []; | ||
|
|
||
| /// The current search query. | ||
| String _searchQuery = ''; | ||
|
|
||
| /// The number of journeys matching the active search and filters. | ||
| int _filteredCujCount = 0; | ||
|
|
||
| @override | ||
| void initState() { | ||
| super.initState(); | ||
|
|
||
| if (kIsWeb) { | ||
| _filters.addListener(_setFilters); | ||
|
|
||
| final cujList = web.document.getElementById('all-cujs-list'); | ||
| if (cujList == null) { | ||
| return; | ||
| } | ||
|
|
||
| _recreateCujs(cujList.querySelectorAll('.cuj-card')); | ||
| } | ||
| } | ||
|
|
||
| /// Populates [_cujs] from [cujCards]. | ||
| void _recreateCujs(web.NodeList cujCards) { | ||
| for (var i = 0; i < cujCards.length; i++) { | ||
| final element = cujCards.item(i) as web.Element; | ||
| _cujs.add(Cuj.fromElement(element)); | ||
| } | ||
| _filteredCujCount = _cujs.length; | ||
| } | ||
|
|
||
| /// Updates the filter state and re-evaluates which journeys to show. | ||
| /// | ||
| /// Use like the `setState` method by passing a callback that updates | ||
| /// the relevant state variables. | ||
| void _setFilters([void Function()? callback]) { | ||
| setState(callback ?? () {}); | ||
|
ericwindmill marked this conversation as resolved.
|
||
|
|
||
| final cujsToShow = _filters.filterCujs(_cujs, _searchQuery); | ||
| _filteredCujCount = cujsToShow.length; | ||
| for (final cuj in _cujs) { | ||
| final element = | ||
| web.document.getElementById(cuj.elementId) as web.HTMLElement?; | ||
| if (element == null) { | ||
| continue; | ||
| } | ||
|
|
||
| if (cujsToShow.contains(cuj)) { | ||
| element.classList.remove('hidden'); | ||
| } else { | ||
| element.classList.add('hidden'); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @override | ||
| void dispose() { | ||
| if (kIsWeb) { | ||
| _filters.removeListener(_setFilters); | ||
| } | ||
| super.dispose(); | ||
| } | ||
|
|
||
| @override | ||
| Component build(BuildContext context) { | ||
| return FilterSearchGroup( | ||
| drawerToggleId: CujFilters.drawerToggleId, | ||
| searchId: _searchId, | ||
| placeholder: 'Try "testing" or "architecture"...', | ||
| label: 'Search critical user journeys by goal, persona, and task', | ||
| value: _searchQuery, | ||
| onInput: (value) { | ||
| _setFilters(() { | ||
| _searchQuery = value; | ||
| }); | ||
| }, | ||
| children: [ | ||
| div(classes: 'label-row', [ | ||
| label( | ||
| attributes: {'for': _searchId, 'aria-live': 'polite'}, | ||
| [ | ||
| const .text('Showing '), | ||
| span([.text('$_filteredCujCount')]), | ||
| const .text(' / '), | ||
| span([.text('${_cujs.length}')]), | ||
|
parlough marked this conversation as resolved.
|
||
| ], | ||
| ), | ||
| Button( | ||
| icon: 'close_small', | ||
| content: 'Clear filters', | ||
| size: ButtonSize.compact, | ||
| disabled: _searchQuery.isEmpty && !_filters.hasSelectedPersonas, | ||
| onClick: () { | ||
| // No setState needed, since resetting filters will trigger it. | ||
| _searchQuery = ''; | ||
| _filters.reset(); | ||
| }, | ||
| ), | ||
| ]), | ||
| ], | ||
| ); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.