0.2.0 • Published 11 months ago

@gamescoin/star-dapp-react v0.2.0

Weekly downloads
-
License
-
Repository
-
Last release
11 months ago

npm i

Local Development

npm run start

npm run start:dev

Using UNPKG

<script
  type="module"
  async
  defer
  crossorigin
  src="https://unpkg.com/@gamescoin/star-dapp-react@0.1.33/dist/assets/index-B-ELOJzT.js"
></script>

Web Components

The Webcomponents can be found here.

Usage Step Slider

// Init
const sliderContainer = document.getElementById("slider-container");
const stepSlider = document.createElement("step-slider");

stepSlider.setAttribute("min", "10");
stepSlider.setAttribute("max", "10000");
stepSlider.setAttribute("default-value", "5000");

sliderContainer!.appendChild(stepSlider);

// Usage
const slider = document.querySelector("step-slider") as any;
slider!.updateValue(value);

const handleSliderChange = (event: any) => {
  const newValue = event.detail.value;
};

slider?.addEventListener("value-change", handleSliderChange);
slider!.removeEventListener("value-change", handleSliderChange);

Usage Custom Dropdown / Select

Care, besides value and text content no further HTMLSelectElement-functionality is implemented.

// Init
const tokenSelectContainer = document.getElementById("token-select");
const tokenSelect = document.createElement("custom-dropdown");
tokenSelect.id = "custom-dropdown";

tokenSelectContainer!.appendChild(tokenSelect);

// Usage
const currencyDropdown = document.getElementById(
  "custom-dropdown"
) as HTMLSelectElement;

currencyDropdown!.innerHTML = "";
Object.entries(environment.tokens).forEach(([name, address]) => {
  const option = document.createElement("option");
  option.value = address;
  option.textContent = name;
  currencyDropdown!.appendChild(option);
});

const handleTokenChange = async (event: Event) => {
  const target = event.target as HTMLSelectElement;
  const selectedValue = target.value;
};

currencyDropdown.addEventListener("change", handleTokenChange);

Data Structure

Tokens is a simple record key value object.

const environment = {
  tokens: {
    TST: "0xE953...",
    USDT: "0xE953...",
    USDC: "0xE953...",
  },
};
0.2.0

11 months ago

0.1.54

11 months ago

0.1.52

11 months ago

0.1.51

11 months ago

0.1.50

11 months ago

0.1.49

11 months ago

0.1.48

11 months ago

0.1.47

11 months ago

0.1.46

11 months ago

0.1.45

11 months ago

0.1.44

11 months ago

0.1.43

11 months ago

0.1.42

11 months ago

0.1.41

11 months ago

0.1.40

11 months ago

0.1.39

11 months ago

0.1.38

11 months ago

0.1.37

11 months ago

0.1.36

11 months ago

0.1.35

11 months ago

0.1.33

11 months ago

0.1.32

11 months ago

0.1.31

11 months ago

0.1.30

11 months ago

0.1.29

11 months ago

0.1.28

11 months ago

0.1.27

11 months ago

0.1.25

11 months ago

0.1.24

11 months ago

0.1.22

11 months ago

0.1.21

11 months ago

0.1.20

11 months ago

0.1.19

11 months ago

0.1.18

11 months ago

0.1.17

11 months ago

0.1.16

11 months ago

0.1.15

11 months ago

0.1.14

11 months ago

0.1.13

11 months ago

0.1.12

11 months ago

0.1.11

11 months ago

0.1.10

11 months ago

0.1.9

11 months ago

0.1.8

11 months ago

0.1.7

11 months ago

0.1.6

11 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

12 months ago

0.0.25

12 months ago

0.0.24

12 months ago

0.0.23

12 months ago

0.0.22

12 months ago

0.0.20

12 months ago

0.0.19

12 months ago

0.0.17

12 months ago

0.0.16

12 months ago

0.0.15

12 months ago

0.0.14

12 months ago

0.0.13

12 months ago

0.0.12

12 months ago

0.0.11

12 months ago

0.0.10

12 months ago

0.0.9

12 months ago

0.0.8

12 months ago

0.0.7

12 months ago

0.0.6

12 months ago

0.0.5

12 months ago

0.0.4

12 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago