-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add event handler as prep to insert cells
- Loading branch information
Showing
3 changed files
with
86 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<template> | ||
<Popper trigger="click" placement="right" mode="light" :arrow="false"> | ||
<template v-slot:reference> | ||
<div v-b-tooltip.right class="d-inline text-muted ml-2 cursor-pointer" title="Insert new Cell"> | ||
<FontAwesomeIcon :icon="faPlusSquare" /> | ||
</div> | ||
</template> | ||
<div class="cursor-pointer"> | ||
<CellOption | ||
title="Markdown" | ||
description="Markdown text element" | ||
:icon="faPlusSquare" | ||
@click="onClick('markdown')" /> | ||
<CellOption title="Vega" description="Vega Graphics" @click="onClick('vega')" /> | ||
</div> | ||
</Popper> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { faPlusSquare } from "@fortawesome/free-regular-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; | ||
import CellOption from "./CellOption.vue"; | ||
import Popper from "@/components/Popper/Popper.vue"; | ||
const props = defineProps<{ | ||
cellIndex: number; | ||
}>(); | ||
const emit = defineEmits<{ | ||
(e: "click", cellIndex: number, cellType: string): void; | ||
}>(); | ||
function onClick(cellType: string) { | ||
emit("click", props.cellIndex, cellType); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<template> | ||
<div class="cell-option d-flex justify-content-between rounded m-1" @click="$emit('click')"> | ||
<div class="m-2"> | ||
<div class="font-weight-bold">{{ title }}</div> | ||
<small>{{ description }}</small> | ||
</div> | ||
<div v-if="icon" class="m-2 align-self-center"> | ||
<FontAwesomeIcon :icon="icon" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; | ||
defineProps<{ | ||
title: string; | ||
description: string; | ||
icon?: any; | ||
}>(); | ||
defineEmits<{ | ||
(e: "click"): void; | ||
}>(); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
@import "theme/blue.scss"; | ||
.cell-option { | ||
&:hover { | ||
background: $brand-primary; | ||
color: $white; | ||
small { | ||
color: $white; | ||
} | ||
} | ||
small { | ||
color: $text-muted; | ||
} | ||
} | ||
</style> |