Skip to content

ezhivitsa/color-picker

Repository files navigation

Color-picker

license PRs Welcome

Watch on GitHub Star on GitHub

Color-picker is based on the following primary technologies:

  • webpack
  • postcss
  • webassembly
  • rust
  • yew

Application structured in a way that allows us to write rust code for frontend part through WebAssembly. In particular we rust framework yew to construct html (something similar to jsx in React) and add business logic.

Demo

https://ezhivitsa.github.io/color-picker/

How to start development

Type the following command to install dependencies:

$ make deps

To run webpack build of the rust and js files type the following command:

$ make dev

And open in the browser http://localhost:8080

How to make a build

To make a final build type the following command:

$ make build

How to start tests

To start tests type the following command:

$ make test

How wo publish on github pages demo

To start tests type the following command:

$ make deploy

Explanations of the files structure.

  1. src/client/styles - global styles and css variables, styles for components
  2. src/wasm - this folder contains Rust codebase. We compile wasm file using this code.
  3. src/wasm/agents - this folder contains code with yew agents to handle business logic. For example here we handle all changes in input and recalculate new current color.
  4. src/wasm/constants - this folder contains constants which can be used across the application.
  5. src/wasm/libs - folder with common functions where we can do some common actions, for example transformations or validations. This functions help us to avoid copy-paste of functionality.
  6. src/wasm/services - folder with yew services, for example^ here we have a service to handle global mouse events (mouse events for body tag)
  7. src/wasm/components - yew components (similar to React components).
  8. src/wasm/texts - static texts

Important things to keep in mind

  • For css class names we use BEM conventions, because it's convenient when your styles are separate from usage. This allows us to not think about intersections of class names.

Conventions

  • For naming we use rust code style
  • For code format use built-in formatter (cargo fmt)

License

Color-picker is released under the MIT License.

About

Color-picker with frontend logic on WebAssembly

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published