0.2.0 • Published 2 years ago

@gamescoin/star-dapp-react v0.2.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years 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

2 years ago

0.1.54

2 years ago

0.1.52

2 years ago

0.1.51

2 years ago

0.1.50

2 years ago

0.1.49

2 years ago

0.1.48

2 years ago

0.1.47

2 years ago

0.1.46

2 years ago

0.1.45

2 years ago

0.1.44

2 years ago

0.1.43

2 years ago

0.1.42

2 years ago

0.1.41

2 years ago

0.1.40

2 years ago

0.1.39

2 years ago

0.1.38

2 years ago

0.1.37

2 years ago

0.1.36

2 years ago

0.1.35

2 years ago

0.1.33

2 years ago

0.1.32

2 years ago

0.1.31

2 years ago

0.1.30

2 years ago

0.1.29

2 years ago

0.1.28

2 years ago

0.1.27

2 years ago

0.1.25

2 years ago

0.1.24

2 years ago

0.1.22

2 years ago

0.1.21

2 years ago

0.1.20

2 years ago

0.1.19

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago