Grabbed dndbeyond's source code
``` ~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js ```
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import * as React from "react";
|
||||
|
||||
import { Tooltip } from "@dndbeyond/character-common-components/es";
|
||||
import {
|
||||
Action,
|
||||
ActionUtils,
|
||||
CharacterTheme,
|
||||
} from "@dndbeyond/character-rules-engine/es";
|
||||
|
||||
interface Props {
|
||||
action: Action;
|
||||
onClick?: (action: Action) => void;
|
||||
className: string;
|
||||
theme?: CharacterTheme;
|
||||
}
|
||||
export default class ActionName extends React.PureComponent<Props> {
|
||||
static defaultProps = {
|
||||
className: "",
|
||||
};
|
||||
|
||||
handleClick = (evt: React.MouseEvent): void => {
|
||||
const { onClick, action } = this.props;
|
||||
|
||||
if (onClick) {
|
||||
evt.stopPropagation();
|
||||
evt.nativeEvent.stopImmediatePropagation();
|
||||
|
||||
onClick(action);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { action, className, theme } = this.props;
|
||||
|
||||
let isCustomized = ActionUtils.isCustomized(action);
|
||||
let classNames: Array<string> = [className, "ddbc-action-name"];
|
||||
|
||||
return (
|
||||
<span className={classNames.join(" ")} onClick={this.handleClick}>
|
||||
{ActionUtils.getName(action)}
|
||||
{isCustomized && (
|
||||
<Tooltip
|
||||
title="Action is Customized"
|
||||
className="ddbc-action-name__customized"
|
||||
isDarkMode={theme?.isDarkMode}
|
||||
>
|
||||
*
|
||||
</Tooltip>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import ActionName from "./ActionName";
|
||||
|
||||
export default ActionName;
|
||||
export { ActionName };
|
||||
Reference in New Issue
Block a user