Files
privacy.sexy/src/presentation/components/Code/CodeButtons/IconButton.vue
undergroundwires 1b9be8fe2d Refactor Vue components using Composition API #230
- Migrate `StatefulVue`:
  - Introduce `UseCollectionState` that replaces its behavior and acts
    as a shared state store.
  - Add more encapsulated, granular functions based on read or write
    access to state in CollectionState.
- Some linting rules get activates due to new code-base compability to
  modern parses, fix linting errors.
  - Rename Dialog to ModalDialog as after refactoring,
    eslintvue/no-reserved-component-names does not allow name Dialog.
  - To comply with `vue/multi-word-component-names`, rename:
    - `Code`          -> `CodeInstruction`
    - `Handle`        -> `SliderHandle`
    - `Documentable`  -> `DocumentableNode`
    - `Node`          -> `NodeContent`
    - `INode`         -> `INodeContent`
    - `Responsive`    -> `SizeObserver`
- Remove `vue-property-decorator` and `vue-class-component`
  dependencies.
- Refactor `watch` with computed properties when possible for cleaner
  code.
  - Introduce `UseApplication` to reduce repeated code in new components
    that use `computed` more heavily than before.
- Change TypeScript target to `es2017` to allow top level async calls
  for getting application context/state/instance to simplify the code by
  removing async calls. However, mocha (unit and integration) tests do
  not run with top level awaits, so a workaround is used.
2023-08-07 13:16:39 +02:00

94 lines
1.6 KiB
Vue

<template>
<button
class="button"
type="button"
@click="onClicked"
>
<font-awesome-icon
class="button__icon"
:icon="[iconPrefix, iconName]"
size="2x"
/>
<div class="button__text">{{text}}</div>
</button>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
props: {
text: {
type: String,
required: true,
},
iconPrefix: {
type: String,
required: true,
},
iconName: {
type: String,
required: true,
},
},
emits: [
'click',
],
setup(_, { emit }) {
function onClicked() {
emit('click');
}
return {
onClicked,
};
},
});
</script>
<style scoped lang="scss">
@use "@/presentation/assets/styles/main" as *;
.button {
display: flex;
flex-direction: column;
align-items: center;
background-color: $color-secondary;
color: $color-on-secondary;
border: none;
padding:20px;
transition-duration: 0.4s;
overflow: hidden;
box-shadow: 0 3px 9px $color-primary-darkest;
border-radius: 4px;
@include clickable;
width: 10%;
min-width: 90px;
@include hover-or-touch {
background: $color-surface;
box-shadow: 0px 2px 10px 5px $color-secondary;
}
@include hover-or-touch('>&__text') {
display: block;
}
@include hover-or-touch('>&__icon') {
display: none;
}
&__text {
display: none;
font-family: $font-artistic;
font-size: 1.5em;
color: $color-primary;
font-weight: 500;
line-height: 1.1;
@include hover-or-touch {
display: block;
}
}
}
</style>