0.2.0 • Published 1 year ago

@gamescoin/star-dapp-react v0.2.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year 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

1 year ago

0.1.54

1 year ago

0.1.52

1 year ago

0.1.51

1 year ago

0.1.50

1 year ago

0.1.49

1 year ago

0.1.48

1 year ago

0.1.47

1 year ago

0.1.46

1 year ago

0.1.45

1 year ago

0.1.44

1 year ago

0.1.43

1 year ago

0.1.42

1 year ago

0.1.41

1 year ago

0.1.40

1 year ago

0.1.39

1 year ago

0.1.38

1 year ago

0.1.37

1 year ago

0.1.36

1 year ago

0.1.35

1 year ago

0.1.33

1 year ago

0.1.32

1 year ago

0.1.31

1 year ago

0.1.30

1 year ago

0.1.29

1 year ago

0.1.28

1 year ago

0.1.27

1 year ago

0.1.25

1 year ago

0.1.24

1 year ago

0.1.22

1 year ago

0.1.21

1 year ago

0.1.20

1 year ago

0.1.19

1 year ago

0.1.18

1 year ago

0.1.17

1 year ago

0.1.16

1 year ago

0.1.15

1 year ago

0.1.14

1 year ago

0.1.13

1 year ago

0.1.12

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.25

1 year ago

0.0.24

1 year ago

0.0.23

1 year ago

0.0.22

1 year ago

0.0.20

1 year ago

0.0.19

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago