Skip to content

Commit

Permalink
resolved errors in DocsExample
Browse files Browse the repository at this point in the history
  • Loading branch information
chetan2112204 committed Dec 11, 2024
1 parent 8d2e301 commit fad3c15
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 19 deletions.
1 change: 1 addition & 0 deletions custom-icons/codeToggle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 25 additions & 19 deletions docs/common/DocsExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@


<div class="code-toggle-button">
<button @click="toggleCodeVisibility">
<span>&lt;/&gt;</span>
</button>
</div>
<KIconButton class="code-toggle"
:icon="isCodeVisible ? 'chevronUp' : 'codeToggle'"
tooltip="Toggle code visibility"
@click="toggleCodeVisibility"
/>
</div>

<!-- Toggle code -->
<div v-if="isCodeVisible" class="code-container">
<div v-show="isCodeVisible" class="code-container">
<slot name="code" />
</div>

Expand All @@ -18,63 +20,67 @@
<slot />
</div>


</div>
</template>


<script>
import KIconButton from "../../lib/buttons-and-links/KIconButton.vue";
export default {
name: "DocsExample",
components: {
KIconButton
},
data() {
return {
isCodeVisible: false,
isCodeVisible: false,
};
},
methods: {
toggleCodeVisibility() {
this.isCodeVisible = !this.isCodeVisible;
this.isCodeVisible = !this.isCodeVisible;
},
},
};
</script>



<style scoped>
.docs-example {
margin-bottom: 24px;
padding-top: 0;
padding: 20px;
/* border: 1px solid #ddd; */
border-radius: 4px;
}
.code-toggle-button {
margin-bottom: 16px;
display: flex;
justify-content: flex-end;
}
button {
.code-toggle {
padding: 8px 16px;
background-color: #007bff;
background-color: #f5d858;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
.code-toggle:hover {
background-color: #0056b3;
}
.code-container {
border: none;
transition: all 2s ease-in-out; /* Adjusted duration for smoother transition */
}
</style>

3 changes: 3 additions & 0 deletions lib/KIcon/iconDefinitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import { themePalette, themeTokens } from '../styles/theme';

const KolibriIcons = {
// UI
codeToggle:{
icon: require('./precompiled-icons/le/codeToggle.vue').default,
} ,
menu: { icon: require('./precompiled-icons/material-icons/menu/baseline.vue').default },
dropdown: {
icon: require('./precompiled-icons/material-icons/arrow_drop_down/baseline.vue').default,
Expand Down
12 changes: 12 additions & 0 deletions lib/KIcon/precompiled-icons/le/codeToggle.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>

<svg role="presentation" focusable="false" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24" fill="#e8eaed"><path d="M320-240L80-480l240-240 57 57-184 184 183 183-56 56zm320 0l-57-57 184-184-183-183 56-56 240 240-240 240z"/></svg>

</template>


<script>
export default {"name":"icon-acc9ffc9ffc227bbc1a5234a3216c548"}
</script>

0 comments on commit fad3c15

Please sign in to comment.