phantasmal-world/src/ui/viewer/models/AnimationSelectionComponent.tsx
2019-07-11 17:30:23 +02:00

33 lines
1.2 KiB
TypeScript

import React, { Component, ReactNode } from "react";
import { model_viewer_store } from "../../../stores/ModelViewerStore";
import "./AnimationSelectionComponent.less";
import { observer } from "mobx-react";
@observer
export class AnimationSelectionComponent extends Component {
render(): ReactNode {
return (
<section className="v-m-AnimationSelectionComponent">
<ul>
{model_viewer_store.animations.map(animation => {
const selected =
model_viewer_store.animation &&
model_viewer_store.animation.player_animation &&
model_viewer_store.animation.player_animation.id === animation.id;
return (
<li
key={animation.id}
className={selected ? "selected" : undefined}
onClick={() => model_viewer_store.load_animation(animation)}
>
{animation.name}
</li>
);
})}
</ul>
</section>
);
}
}