New source found from dndbeyond.com
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useCallback } from "react";
|
||||
|
||||
import { RollRequest } from "@dndbeyond/dice";
|
||||
import { RollDicePayload } from "@dndbeyond/pocket-dimension-dice/types";
|
||||
|
||||
import LoadingPlaceholder from "../../LoadingPlaceholder";
|
||||
import { DataLoadingStatusEnum } from "../../componentConstants";
|
||||
@@ -14,7 +14,7 @@ export interface DiceRollProps {
|
||||
rollKey: string;
|
||||
nextRollKey: string | null;
|
||||
rollTotal: number | null;
|
||||
diceRollRequest: RollRequest;
|
||||
diceRollRequest: RollDicePayload["data"];
|
||||
onChange?: (
|
||||
key: string,
|
||||
newValue: string | null,
|
||||
@@ -25,7 +25,7 @@ export interface DiceRollProps {
|
||||
) => void;
|
||||
onRoll: (
|
||||
key: string,
|
||||
diceRollRequest: RollRequest,
|
||||
diceRollRequest: RollDicePayload["data"],
|
||||
nextRollKey: string | null
|
||||
) => void;
|
||||
rollValues: DiceRollValuesProps["rollValues"];
|
||||
@@ -87,7 +87,7 @@ const DiceRoll: React.FunctionComponent<DiceRollProps> = ({
|
||||
}
|
||||
|
||||
contentNode = (
|
||||
<React.Fragment>
|
||||
<>
|
||||
<div className={diceTotalClassNames.join(" ")}>
|
||||
<label className="ddbc-dice-roll__total-label" htmlFor={rollKey}>
|
||||
{rollTotal ?? "--"}
|
||||
@@ -107,7 +107,7 @@ const DiceRoll: React.FunctionComponent<DiceRollProps> = ({
|
||||
rollButtonText={rollButtonText}
|
||||
selectPlaceholderText={selectPlaceholderText}
|
||||
/>
|
||||
</React.Fragment>
|
||||
</>
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
+6
-2
@@ -2,9 +2,11 @@ import React from "react";
|
||||
|
||||
import { HtmlSelectOption } from "@dndbeyond/character-rules-engine/es";
|
||||
|
||||
import { Select } from "~/components/Select";
|
||||
|
||||
import { DataLoadingStatusEnum } from "../../../componentConstants";
|
||||
import { Button } from "../../../legacy/Button";
|
||||
import { Select } from "../../../legacy/Select";
|
||||
import styles from "./styles.module.css";
|
||||
|
||||
export interface DiceRollActionNodeProps {
|
||||
rollKey: string;
|
||||
@@ -15,7 +17,7 @@ export interface DiceRollActionNodeProps {
|
||||
rollButtonText?: string;
|
||||
selectPlaceholderText?: string;
|
||||
onRoll: () => void;
|
||||
onChange?: (newValue: string | null) => void;
|
||||
onChange?: (newValue: string | number) => void;
|
||||
}
|
||||
const DiceRollActionNode: React.FunctionComponent<DiceRollActionNodeProps> = ({
|
||||
rollKey,
|
||||
@@ -31,11 +33,13 @@ const DiceRollActionNode: React.FunctionComponent<DiceRollActionNodeProps> = ({
|
||||
if (options?.length && rollTotal !== null) {
|
||||
return (
|
||||
<Select
|
||||
className={styles.select}
|
||||
id={rollKey}
|
||||
value={assignedValue}
|
||||
options={options}
|
||||
placeholder={selectPlaceholderText}
|
||||
onChange={onChange}
|
||||
name={rollKey}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import DiceRollActionNode from "./DiceRollActionNode";
|
||||
|
||||
//Props typings
|
||||
export * from "./DiceRollActionNode";
|
||||
|
||||
export { DiceRollActionNode };
|
||||
|
||||
export default DiceRollActionNode;
|
||||
+2
-2
@@ -40,7 +40,7 @@ const DiceRollValues: React.FunctionComponent<DiceRollValuesProps> = ({
|
||||
const classNames: Array<string> = ["ddbc-dice-roll__dice-value"];
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<>
|
||||
{orderedKeptDiceValues.map((rollValue: RollValueContract, idx) => {
|
||||
return (
|
||||
<div key={idx} className={classNames.join(" ")}>
|
||||
@@ -57,7 +57,7 @@ const DiceRollValues: React.FunctionComponent<DiceRollValuesProps> = ({
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</React.Fragment>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import DiceRollValues from "./DiceRollValues";
|
||||
|
||||
//Props typings
|
||||
export * from "./DiceRollValues";
|
||||
|
||||
export { DiceRollValues };
|
||||
|
||||
export default DiceRollValues;
|
||||
@@ -0,0 +1,10 @@
|
||||
import DiceRoll from "./DiceRoll";
|
||||
|
||||
//Props typings
|
||||
export * from "./DiceRoll";
|
||||
export * from "./DiceRollValues";
|
||||
export * from "./DiceRollActionNode";
|
||||
|
||||
export { DiceRoll };
|
||||
|
||||
export default DiceRoll;
|
||||
Reference in New Issue
Block a user