Skip to content

Set up shared package for components and utilities.#13259

Open
schultek wants to merge 14 commits intomainfrom
feat/site_shared
Open

Set up shared package for components and utilities.#13259
schultek wants to merge 14 commits intomainfrom
feat/site_shared

Conversation

@schultek
Copy link
Copy Markdown
Contributor

@schultek schultek commented Apr 8, 2026

Adds a new site_shared package that contains components and other utilities for sharing with dart-lang/site-www.

  • Simply moved all components that are the same between both sites.
  • Moved and adapted components that exist on both sites but are slightly different (e.g. SiteSwitcher, Quiz)
  • Moved all styles related to a component that is also moved.
  • Moved the markdown rendering setup, which is the same for both sites.
  • Moved some utilities that are needed by components like analytics and code highlighting.

@schultek schultek requested a review from parlough April 8, 2026 11:47
@flutter-website-bot
Copy link
Copy Markdown
Collaborator

flutter-website-bot commented Apr 8, 2026

Visit the preview URL for this PR (updated for commit c4007b2):

https://flutter-docs-prod--pr13259-feat-site-shared-oeuo1lvo.web.app

@parlough parlough changed the title [WIP] Setup shared package for components and utilities. [WIP] Set up shared package for components and utilities. Apr 8, 2026
@schultek schultek marked this pull request as ready for review April 9, 2026 10:50
@schultek schultek requested review from a team and sfshaza2 as code owners April 9, 2026 10:50
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new site_shared package to centralize common components, utilities, and SCSS previously duplicated across the site and other packages. Key changes include extensive refactoring of SCSS imports, relocation of numerous Dart files to the new site_shared package with corresponding import path updates, and significant improvements to component handling and hydration logic, particularly for ComponentRef. Specific component updates include adding trailingIcon to Button, new parameters for CookieNotice and CopyButton, and refactoring quiz parsing in tutorial/quiz.dart. Review feedback points out two critical issues: inconsistent markdown parsing and weak validation in tutorial/quiz.dart for quizzes defined in tags, and a potential crash in util.dart's getOS() function due to web.window access during server-side rendering.

Comment thread packages/site_shared/lib/components/tutorial/quiz.dart
Comment thread packages/site_shared/lib/util.dart
Copy link
Copy Markdown
Contributor

@sfshaza2 sfshaza2 left a comment

Choose a reason for hiding this comment

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

lgtm. I leave it to you, @schultek, to fix the build issues.

@parlough parlough self-assigned this Apr 9, 2026
@parlough
Copy link
Copy Markdown
Member

parlough commented Apr 9, 2026

Thanks for tackling this Kilian! I'm excited.

Hold off on landing this. I'd like to take a look first. I should have time early next week.

Copy link
Copy Markdown
Member

@parlough parlough left a comment

Choose a reason for hiding this comment

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

Exciting!! I haven't tested the stage site yet, but generally the direction looks great to me.

I had a few small comments and main has some updates to integrate.

Thanks so much for tackling this :D

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we move the individual syntaxes to the src directory?

Comment thread packages/site_shared/lib/components/tutorial/stepper.dart Outdated
Comment thread packages/site_shared/lib/layouts/dash_layout.dart Outdated
Comment thread packages/site_shared/lib/components/utils/define_component.dart
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add a basic README to this directory as well stating something about how it's intended for APIs meant to be used by dart.dev and docs.flutter.dev.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

generated something

Comment thread packages/site_shared/lib/util.dart
Comment thread packages/site_shared/lib/src/utils/retake_element_web.dart
Comment thread site/lib/src/layouts/dash_layout.dart
Comment thread packages/site_shared/lib/components/layout/site_switcher.dart
Comment thread site/lib/src/components/util/component_ref.dart
Comment thread packages/site_shared/lib/_sass/components/_site-switcher.scss Outdated
@parlough parlough assigned schultek and unassigned parlough Apr 27, 2026
@schultek schultek changed the title [WIP] Set up shared package for components and utilities. Set up shared package for components and utilities. Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants