Skip to content

Update Component overview content #25

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

Merged
merged 10 commits into from
Feb 4, 2021
Merged

Update Component overview content #25

merged 10 commits into from
Feb 4, 2021

Conversation

arthurevans
Copy link
Contributor

Can't stage ATM

@arthurevans
Copy link
Contributor Author

order: 1
---

A Lit component is a reusable piece of UI. You can think of a Lit component as a container that has some state and that displays its state to the user. It may also react to user input, fire events—anything you'd expect a UI component to do.
Copy link
Member

Choose a reason for hiding this comment

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

It might be nice to have a little section on firing events that basically just says you should do it to notify that the state of the element has changed (e.g. a slider) and that you should use the native dispatchEvent and either addEventListener or a lit event expression...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where would you picture this going in the section?

Co-authored-by: Steve Orvell <sorvell@google.com>
@github-actions
Copy link

github-actions bot commented Jan 25, 2021

A live preview of this PR will be available at the URL(s) below.
The latest URL will be appended to this comment on each push.
Each build usually takes around 7 minutes, and will 404 until finished.

https://pr25-04ecbe6---lit-dev-bvxw3ycs6q-uw.a.run.app/
https://pr25-dd41e20---lit-dev-bvxw3ycs6q-uw.a.run.app/


* A *render method* that's called to render the components' contents. In the render method, you define a *template* for the component.

Lit also provides a set of lifecycle methods that you can override to hook into the component's lifecycle (for example, to run code whenever the component updates).
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if this sentence is necessary just yet. We could get to the example faster without it. And if the update lifecycle is up there in importance with properties and render(), maybe it should have a short section on this page following "Reactive Properties"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy to remove it if you think it's OK.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes sense for it to have its own very short section along with "Styling" as I mentioned elsewhere. Then the page outline would look like:

  • A Lit component is an HTML element
  • Rendering, templates
  • Styles
  • Reactive properties
  • Reactive lifecycle

which is kind of a great tweet-sized summary of LitElement on its own

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm holding off on this for now because reorganizing into these buckets is going to require a fairly major rewrite to the section.


Here's a sample component:

{% playground-example "docs/components/overview/simple-greeting" "simple-greeting.ts" %}
Copy link
Contributor

Choose a reason for hiding this comment

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

@aomarks is there a way to make this sample sized to fit the contents? I think ideally we wouldn't scroll here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Blocked on #138. We can fix this when it's merged.

@arthurevans arthurevans merged commit 40fa228 into master Feb 4, 2021
@aomarks aomarks deleted the fundamentals branch October 8, 2021 22:08
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