Skip to content

Commit

Permalink
Add header component and overwrite step
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjacob committed May 24, 2024
1 parent 462d97f commit 7989e4a
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 6 deletions.
34 changes: 34 additions & 0 deletions components/Kryptos/Header.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script setup lang="ts">
const props = defineProps({
page: Number,
length: Number
});
</script>

<template>
<header>
<sub v-if="!page">...</sub>
<h1 v-if="page">k{{page}}</h1>
<sub v-if="page">({{length}})</sub>
</header>
</template>

<style scoped>
header {
display: flex;
flex-flow: row nowrap;
margin: 2rem 0;
justify-content: center;
align-items: stretch;
}
sub {
vertical-align: sub;
display: inline;
}
h1 {
font-size: 2rem;
margin: 0;
}
</style>
4 changes: 3 additions & 1 deletion components/Kryptos/Step/Base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import KryptosStepRotate from './Rotate.vue';
import KryptosStepReverse from './Reverse.vue';
import KryptosStepPad from './Pad.vue';
import KryptosStepJump from './Jump.vue';
import KryptosStepOverwrite from './Overwrite.vue';
const emit = defineEmits(['change', 'remove']);
Expand All @@ -25,7 +26,8 @@ const modes = [
KryptosStepRotate,
KryptosStepReverse,
KryptosStepPad,
KryptosStepJump
KryptosStepJump,
KryptosStepOverwrite
];
</script>

Expand Down
1 change: 1 addition & 0 deletions components/Kryptos/Step/Mode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const model = defineModel();
<option value="2">Reverse</option>
<option value="3">Pad</option>
<option value="4">Jump</option>
<option value="5">Overwrite</option>
</select>
</template>

Expand Down
14 changes: 14 additions & 0 deletions components/Kryptos/Step/Overwrite.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script setup lang="ts">
const emit = defineEmits(['change']);
const props = defineProps({input: String});
const modded = ref(props.input);
const propagate = () => emit('change', modded.value);
onMounted(propagate);
watch(modded, propagate);
</script>

<template>
<textarea v-model="modded"/>
</template>
7 changes: 2 additions & 5 deletions pages/k[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ useHead({ title: 'K' + route.params.id });
<template>
<div id="split">
<aside>
<KryptosNav />
<header>
<h1>k{{page}}</h1>
<sub>({{cipher.length}})</sub>
</header>
<KryptosNav/>
<KryptosHeader :page :length="cipher.length"/>
<KryptosSolution :page/>
<KryptosPipeline :input @change="cipher = $event"/>
<KryptosResize v-model.number="width"/>
Expand Down

0 comments on commit 7989e4a

Please sign in to comment.