Feast 2.0!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

87 lines
1.6 KiB

  1. <template>
  2. <div class="item-view">
  3. <div class="item-content">
  4. <div class="item-name">{{ item.name.capital.all.toString() }}</div>
  5. </div>
  6. <i :class="'item-icon ' + $data.ItemKindIcons[item.kind]" />
  7. <div class="item-hover">
  8. <div class="item-hover-text">{{ hoverText }}</div>
  9. </div>
  10. </div>
  11. </template>
  12. <script lang="ts">
  13. import { Component, Prop, Vue, Watch, Emit } from 'vue-property-decorator'
  14. import { Item, ItemKindIcons, ItemKind } from '@/game/items'
  15. @Component({
  16. data () {
  17. return {
  18. ItemKindIcons: ItemKindIcons
  19. }
  20. }
  21. })
  22. export default class ItemView extends Vue {
  23. get hoverText () {
  24. switch (this.item.kind) {
  25. case ItemKind.Key: return "Inspect"
  26. case ItemKind.Consumable: return "Use"
  27. case ItemKind.Equipment: return "Equip"
  28. }
  29. }
  30. @Prop({ required: true })
  31. item!: Item
  32. }
  33. </script>
  34. <!-- Add "scoped" attribute to limit CSS to this component only -->
  35. <style scoped>
  36. .item-view {
  37. position: relative;
  38. border: 4px outset;
  39. border-radius: 4px;
  40. margin: 4px;
  41. }
  42. .item-content {
  43. position: relative;
  44. padding: 4px;
  45. z-index: 1;
  46. }
  47. .item-name {
  48. font-size: 1.5rem;
  49. }
  50. .item-icon {
  51. color: #666;
  52. font-size: 250%;
  53. position: absolute;
  54. top: 65%;
  55. left: 50%;
  56. transform: translate(-50%, -50%);
  57. }
  58. .item-hover {
  59. display: none;
  60. --item-hover-text: "oops";
  61. }
  62. .item-view:hover .item-hover {
  63. position: absolute;
  64. display: grid;
  65. place-items: center;
  66. top: 0;
  67. left: 0;
  68. background: #ffffff;
  69. color: black;
  70. opacity: 0.5;
  71. width: 100%;
  72. height: 100%;
  73. z-index: 2;
  74. user-select: none;
  75. }
  76. </style>