GithubHelp home page GithubHelp logo

simpledotorg / dhis2-mobile-ui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dhis2/dhis2-mobile-ui

0.0 0.0 0.0 6.05 MB

Compose Multiplatfform DHIS2 Mobile UI components library

License: BSD 3-Clause "New" or "Revised" License

Kotlin 100.00%

dhis2-mobile-ui's Introduction

DHIS2 Mobile UI

@dhis2/dhis2-mobile-ui is a Compose Multiplatform DHIS2 design system library for Kotlin Multiplatform applications.

DHIS2 Mobile UI library is based in the DHIS2 Mobile Design System Figma library.

This library currently supports desktop and Android targets, in the next versions it will support iOS and web.

Installation

In the module build.gradle.kts:

dependencies {
  implementation("org.hisp.dhis.mobile:designsystem:0.3.0")
}

Usage

setContent {
  DHIS2Theme {
    // A surface container using the 'background' color from the theme
    Surface(
      modifier = Modifier.fillMaxSize(),
      color = SurfaceColor.Container
    ) {
      Components()
    }
  }
}
Button(
  text = provideStringResource("show_more"),
  icon = {
    Icon(
      painter = provideDHIS2Icon(resourceName = "dhis2_blood_a_n_positive"),
      contentDescription = ""
    )
  },
  style = ButtonStyle.KEYBOARDKEY
) {}

Compose Compiler Reports

The Compose Compiler plugin can generate reports / metrics around certain compose-specific concepts that can be useful to understand what is happening with some of your compose code at a fine-grained level. You can read more about it here.

To generate the reports / metrics, run the following Gradle command

./gradlew assembleDebug -PenableComposeCompilerReports=true

This would generate the output at <module>/build/compose_metrics

Screenshot Testing

We are using Paparazzi for screenshot testing.

Screenshot testing

class InputChipSnapshotTest {

  @get:Rule
  val paparazzi = paparazzi()

  @Test
  fun launchChip() {
    paparazzi.snapshot {
      ColumnComponentContainer {
        InputChip(label = "Label", selected = false, badge = "3")
        InputChip(label = "Label", selected = true, badge = "3")
      }
    }
  }
}

Running tests

./gradlew designsystem:testDebugUnitTest

Runs tests and generates an HTML report at /build/reports/paparazzi/ showing all test runs and snapshots.

Saving golden images to repo

./gradlew designsystem:recordPaparazziDebug

Saves snapshots as golden values to a predefined source-controlled location (defaults to /src/test/snapshots).

Verifying

./gradlew designsystem:verifyPaparazziDebug

Runs tests and verifies against previously-recorded golden values. Failures generate diffs at /build/paparazzi/failures.

Documentation

The Mobile UI documentation is integrated in the developer portal. It uses Docusaurus, a modern tool to build documentation pages.

The documentation is written in Markdown. The sidebar is automatically generated based on the metadata of the different files. It follows the rules explained in the autogenerated sidebar docs. In short, every file must have a sidebar_position label at the beginning of the document, which defines the position of the document relative to its folder. Then, each folder has a _category_.yml file, which has a position property defining the position of that folder relative to its parent folder.

It is possible to nest as many folders as desired following that pattern.

Testing

It is possible to build the Developers portal documentation to test your changes.

Steps to test:

  1. Do the changes in the Mobile UI docs and push them to a branch in github.
  2. Download the Deverlopers portal repository.
  3. Change the branch in the Mobile UI block in the file docs-migrate.js to point to your branch.
  4. Follow the instructions in CONTRIBUTING to build the docs.

dhis2-mobile-ui's People

Contributors

andresmr avatar balcan avatar davidaparicioalbaasenjo avatar ferdyrod avatar mmmateos avatar msasikanth avatar philip-larsen-donnelly avatar siddh1004 avatar vgarciabnz avatar xavimolloy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.