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,63 @@
|
||||
import * as React from "react";
|
||||
|
||||
import {
|
||||
CharacterTheme,
|
||||
Constants,
|
||||
} from "@dndbeyond/character-rules-engine/es";
|
||||
|
||||
import HalfProficiencyIcon from "./HalfProficiencyIcon";
|
||||
import NoProficiencyIcon from "./NoProficiencyIcon";
|
||||
import ProficiencyIcon from "./ProficiencyIcon";
|
||||
import TwiceProficiencyIcon from "./TwiceProficiencyIcon";
|
||||
|
||||
interface Props {
|
||||
proficiencyLevel: number;
|
||||
isModified: boolean;
|
||||
theme?: CharacterTheme;
|
||||
}
|
||||
export default class ProficiencyLevelIcon extends React.PureComponent<Props> {
|
||||
static defaultProps = {
|
||||
isModified: false,
|
||||
};
|
||||
|
||||
render() {
|
||||
const { proficiencyLevel, isModified, theme } = this.props;
|
||||
|
||||
let IconComponent: React.ComponentType<any> | null = null;
|
||||
let proficiencyVerbiage: string = "Not Proficient";
|
||||
|
||||
switch (proficiencyLevel) {
|
||||
case Constants.ProficiencyLevelEnum.NONE:
|
||||
IconComponent = NoProficiencyIcon;
|
||||
break;
|
||||
case Constants.ProficiencyLevelEnum.HALF:
|
||||
IconComponent = HalfProficiencyIcon;
|
||||
proficiencyVerbiage = "Half Proficient";
|
||||
break;
|
||||
case Constants.ProficiencyLevelEnum.FULL:
|
||||
IconComponent = ProficiencyIcon;
|
||||
proficiencyVerbiage = "Proficient";
|
||||
break;
|
||||
case Constants.ProficiencyLevelEnum.EXPERT:
|
||||
IconComponent = TwiceProficiencyIcon;
|
||||
proficiencyVerbiage = "Expert";
|
||||
break;
|
||||
default:
|
||||
//not implemented
|
||||
}
|
||||
|
||||
if (IconComponent === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<span aria-label={proficiencyVerbiage}>
|
||||
<IconComponent
|
||||
className="ddbc-proficiency-level-icon"
|
||||
isModified={isModified}
|
||||
theme={theme}
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user