Skip to content

Commit

Permalink
changed field name on text-component, added text slider to code compo…
Browse files Browse the repository at this point in the history
…nent on frontend, rebuilt types (#111)

Co-authored-by: Red-Giuliano <red.giuliano@zero-true.com>
  • Loading branch information
Red-Giuliano and Red-Giuliano authored Nov 30, 2023
1 parent 1068430 commit ac7ac1e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion zt_backend/models/components/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Text(ZTComponent):
"""A class for static text components inheriting from ZTComponent."""
component: str = Field("v-text", description="Vue component name for static text.")
text: str = Field("", description="The actual text content.")
text_type: str = Field('text-body-1', enum=[
type: str = Field('text-body-1', enum=[
'text-h1', 'text-h2', 'text-h3', 'text-h4', 'text-h5', 'text-h6',
'text-subtitle-1', 'text-subtitle-2', 'text-body-1', 'text-body-2',
'text-button', 'text-caption', 'text-overline'
Expand Down
3 changes: 2 additions & 1 deletion zt_backend/models/generate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ def generate_schema():
generate_json(Image,'image')
generate_json(Layout,'layout')
generate_json(Autocomplete,'autocomplete')
generate_json(Card,'card')
generate_json(Card,'card')
generate_json(Text,'text')
2 changes: 2 additions & 0 deletions zt_frontend/src/components/CodeComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ import {
import { VDataTable } from "vuetify/labs/VDataTable";
import { CodeCell, Layout } from "@/types/notebook";
import LayoutComponent from "@/components/LayoutComponent.vue";
import TextComponent from "@/components/TextComponent.vue"
export default {
components: {
Expand All @@ -184,6 +185,7 @@ export default {
"v-data-table": VDataTable,
"v-autocomplete": VAutocomplete,
"v-card": VCard,
"v-text": TextComponent,
"plotly-plot": PlotlyPlot,
"layout-component": LayoutComponent,
},
Expand Down
4 changes: 2 additions & 2 deletions zt_frontend/src/components/TextComponent.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="text_type" :style="{ color: color }">
<div :class="type" :style="{ color: color }">
{{ text }}
</div>
</template>
Expand All @@ -13,7 +13,7 @@ export default defineComponent({
type: String,
required: true,
},
text_type: {
type: {
type: String,
required: true,
},
Expand Down
4 changes: 2 additions & 2 deletions zt_frontend/src/types/text.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type Text1 = string;
/**
* Text type for text-related components.
*/
export type TextType =
export type Type =
| "text-h1"
| "text-h2"
| "text-h3"
Expand Down Expand Up @@ -55,7 +55,7 @@ export interface Text {
variable_name?: VariableName;
component?: Component;
text?: Text1;
text_type?: TextType;
type?: Type;
color?: Color;
triggerEvent?: Triggerevent;
[k: string]: unknown;
Expand Down

0 comments on commit ac7ac1e

Please sign in to comment.