Skip to content

Commit

Permalink
✨ share button
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Mar 27, 2024
1 parent 51b8b6e commit 58ab69d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/front-end/scripts/views/story/actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { defineComponent } from "vue";
const Actions = defineComponent({
methods: {
async copyUrl() {
await window.navigator.clipboard.writeText(window.location.href);
alert("The room URL has been copied to your clipboard!");
},
reveal() {
if (
this.$store.state.story.story?.owner !== this.$store.state.session.id &&
Expand All @@ -21,6 +25,12 @@ export default Actions;

<template>
<ul class="x">
<li>
<button @click="copyUrl">
<span aria-hidden="true">📋</span>
Share
</button>
</li>
<li>
<button :disabled="$store.state.story.story?.revealed" @click="reveal">
<span aria-hidden="true">👀</span>
Expand All @@ -29,3 +39,9 @@ export default Actions;
</li>
</ul>
</template>

<style lang="less" scoped>
button {
margin-right: var(--space-m);
}
</style>
4 changes: 4 additions & 0 deletions src/front-end/styles/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ legend {
list-style-position: inside;
margin: 0;
padding: 0;

& li {
display: inline-block;
}
}
}

Expand Down

0 comments on commit 58ab69d

Please sign in to comment.