Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Components#958

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
levkk merged 22 commits intomasterfromlevkk-components-1
Aug 29, 2023
Merged

Components#958

levkk merged 22 commits intomasterfromlevkk-components-1
Aug 29, 2023

Conversation

levkk
Copy link
Contributor

@levkklevkk commentedAug 28, 2023
edited
Loading

Components

Introducing server-side rendered frontend components. The idea is pretty simple: use composition like in React to build UIs, except the components are type-checked and rendered by the backend.

The base component can render any other component, including just strings. To make a Sailfish template into a component, just callcomponent! on the struct, e.g:component!(MyTemplateStruct).MyTemplateStruct must be derived fromsailfish::TemplateOnce.

CLI

To help with building components, we've created acargo command that bundles CSS and JS into their respective bundles and can also generate components.

To install the CLI:

cargo install cargo-pgml-componentsnpm install -g rollupnpm install -g sass

Bundling

Run this after changing Sass or JS code:cargo pgml-components bundle.

Creating new components

cargo pgml-components add component_name

This will automatically generate:

  1. A Rust struct derived fromsailfish::TemplaceOnce
  2. An HTML template file
  3. A Stimulus controller.

Misc

  1. Upgrade Sailfish to 0.8.
  2. Add a/playground page where we should test and render components. Analogous to how Material UI does it:https://mui.com/material-ui/react-autocomplete/
  3. Fix search modal in dashboard being small.

@@ -0,0 +1,10 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

Why this extra whitespace?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Hmm, trim should of worked, good question.

@levkklevkk merged commit6bdcf00 intomasterAug 29, 2023
@levkklevkk deleted the levkk-components-1 branchAugust 29, 2023 22:25
SilasMarvin pushed a commit that referenced this pull requestOct 5, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@montanalowmontanalowmontanalow left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@levkk@montanalow

[8]ページ先頭

©2009-2025 Movatter.jp