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:
+29
@@ -0,0 +1,29 @@
|
||||
import * as React from "react";
|
||||
|
||||
import LinkButton from "../LinkButton";
|
||||
|
||||
interface Props {
|
||||
url: string;
|
||||
className?: string;
|
||||
block?: boolean;
|
||||
size: "oversized" | "large" | "medium" | "small";
|
||||
disabled?: boolean;
|
||||
download?: string | boolean;
|
||||
onClick?: (isDisabled: boolean) => void;
|
||||
}
|
||||
export default class BuilderLinkButton extends React.PureComponent<Props, {}> {
|
||||
static defaultProps = {
|
||||
className: "",
|
||||
};
|
||||
|
||||
render() {
|
||||
const { className, ...restProps } = this.props;
|
||||
|
||||
let classNames: Array<string> = ["builder-button"];
|
||||
if (className) {
|
||||
classNames.push(className);
|
||||
}
|
||||
|
||||
return <LinkButton {...restProps} className={classNames.join(" ")} />;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import BuilderLinkButton from "./BuilderLinkButton";
|
||||
|
||||
export default BuilderLinkButton;
|
||||
export { BuilderLinkButton };
|
||||
@@ -0,0 +1,86 @@
|
||||
import React from "react";
|
||||
|
||||
interface Props {
|
||||
url: string;
|
||||
className: string;
|
||||
block: boolean;
|
||||
size: "oversized" | "large" | "medium" | "small";
|
||||
disabled: boolean;
|
||||
download?: string | boolean;
|
||||
onClick?: (isDisabled: boolean) => void;
|
||||
target?: string;
|
||||
}
|
||||
export default class LinkButton extends React.PureComponent<Props, {}> {
|
||||
static defaultProps = {
|
||||
className: "",
|
||||
clsNames: [],
|
||||
block: false,
|
||||
disabled: false,
|
||||
};
|
||||
|
||||
handleClick = (evt: React.MouseEvent) => {
|
||||
const { onClick, disabled } = this.props;
|
||||
|
||||
if (onClick) {
|
||||
onClick(disabled);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
disabled,
|
||||
block,
|
||||
size,
|
||||
className,
|
||||
url,
|
||||
children,
|
||||
download,
|
||||
target,
|
||||
} = this.props;
|
||||
|
||||
let classNames: Array<string> = ["ct-button", className];
|
||||
|
||||
let buttonSizeBase: string = "character-button";
|
||||
if (block) {
|
||||
buttonSizeBase += "-block";
|
||||
}
|
||||
|
||||
let buttonSizeFinal: string;
|
||||
switch (size) {
|
||||
case "oversized":
|
||||
case "large":
|
||||
case "medium":
|
||||
case "small":
|
||||
buttonSizeFinal = `${buttonSizeBase}-${size}`;
|
||||
break;
|
||||
default:
|
||||
buttonSizeFinal = buttonSizeBase;
|
||||
}
|
||||
classNames.push(buttonSizeFinal);
|
||||
|
||||
if (disabled) {
|
||||
classNames.push("character-button-disabled");
|
||||
classNames.push(`${buttonSizeFinal}-disabled`);
|
||||
}
|
||||
|
||||
if (disabled) {
|
||||
return (
|
||||
<span className={classNames.join(" ")} onClick={this.handleClick}>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<a
|
||||
href={url}
|
||||
target={target}
|
||||
download={download}
|
||||
className={classNames.join(" ")}
|
||||
onClick={this.handleClick}
|
||||
>
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
import * as React from "react";
|
||||
|
||||
import LinkButton from "../LinkButton";
|
||||
|
||||
interface Props {
|
||||
url: string;
|
||||
className?: string;
|
||||
block?: boolean;
|
||||
size: "oversized" | "large" | "medium" | "small";
|
||||
style: "filled" | "outline";
|
||||
disabled?: boolean;
|
||||
download?: string | boolean;
|
||||
target?: string;
|
||||
}
|
||||
export default class ThemeLinkButton extends React.PureComponent<Props, {}> {
|
||||
static defaultProps = {
|
||||
className: "",
|
||||
style: "filled",
|
||||
};
|
||||
|
||||
render() {
|
||||
const { className, style, ...restProps } = this.props;
|
||||
|
||||
let classNames: Array<string> = [
|
||||
"ct-theme-button",
|
||||
`ct-theme-button--${style}`,
|
||||
];
|
||||
if (className) {
|
||||
classNames.push(className);
|
||||
}
|
||||
|
||||
return <LinkButton {...restProps} className={classNames.join(" ")} />;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import ThemeLinkButton from "./ThemeLinkButton";
|
||||
|
||||
export default ThemeLinkButton;
|
||||
export { ThemeLinkButton };
|
||||
Reference in New Issue
Block a user