Skip to content
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

Make contributing easy #39

Closed
OliverO2 opened this issue Dec 3, 2021 · 0 comments · Fixed by #48
Closed

Make contributing easy #39

OliverO2 opened this issue Dec 3, 2021 · 0 comments · Fixed by #48
Assignees

Comments

@OliverO2
Copy link
Contributor

OliverO2 commented Dec 3, 2021

For a possible document or section on how to contribute effectively, here are some initial thoughts I have collected so far (preliminary, does not account for Sass):

Basics

  • Explain style guide.
  • Explain how to configure IDE.
  • Explain pull request workflow.

How to create a Kmdc wrapper

MDC component refers to the material.io Web framework component. A Kmdc component is a Kotlin wrapper component for an MDC component.

Prerequisite:

Let's go:

  1. Read about MDC Architecture and Integrating MDC Web into Frameworks. Kmdc uses "The Simple Approach: Wrapping MDC Web vanilla components".

  2. Pick an MDC component to wrap, familiarize yourself with its interface.

    • Read the MDC component's README (example: mdc-checkbox).
    • Check out the MDC component's Typescript/JavaScript interface.
  3. Create the Kmdc wrapper component. See MDCCheckbox.kt for an example.

    • A trick first:
      • These two lines import the @material stylesheet (@JsModule translates to require):
        @JsModule("@material/checkbox/dist/mdc.checkbox.css")
        external val MDCCheckboxStyle: dynamic
      • In addition, the style variable must be referenced in a function (TODO: where exactly?) to avoid the stylesheet being dropped by DCE.
    • Then declare the Typescript/JavaScript MDC component in Kotlin. See the example code on how to create a module object, declare the component's class, and put static functions into a companion object.
    • Each Kmdc component has
      • the usual Compose for Web attributes (attr),
      • Kmdc component options (opts),
      • other parameters as required.
    • Kmdc component options feature the same builder-style design as attributes.
    • Most MDC components require proper initialization and teardown, which is accomplished via a ref initialization lambda as part of the attrs. Its almost minimal form is shown below. If the MDC component has no destroy() function, provide an empty lambda for onDispose.
       ref {
         it.mdc = MDCCheckboxModule.MDCCheckbox.attachTo(it)
         // more stuff as required
         onDispose {
           it.mdc<MDCCheckboxModule.MDCCheckbox> { destroy() }
         }
       }
@OliverO2 OliverO2 changed the title Make contribution easy Make contributing easy Dec 3, 2021
@mpetuska mpetuska self-assigned this Dec 3, 2021
mpetuska added a commit that referenced this issue Dec 26, 2021
* CONTRIBUTING guidelined pt1

* CONTRIBUTING guidelined pt1

* extend README.md

* Contributing Guidelines pt2

* tmp

* Compose Testing Setup

* Tips and Tricks documentation

* Default to phantomjs test runner

* Default to firefox-headless test runner

* Default to firefox-headless test runner
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 a pull request may close this issue.

2 participants