-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(input-textarea): add preview functionality (#471)
Co-authored-by: Kia King Ishii <kia.king.08@gmail.com>
- Loading branch information
Showing
4 changed files
with
214 additions
and
56 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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
@import "normalize.css"; | ||
@import "v-calendar/dist/style.css"; | ||
@import "./variables-deprecated"; | ||
@import "./variables"; | ||
@import "./base"; | ||
@import "./utilities"; | ||
@import "./variables-deprecated.css"; | ||
@import "./variables.css"; | ||
@import "./base.css"; | ||
@import "./utilities.css"; |
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,97 @@ | ||
<script setup lang="ts"> | ||
import SInputTextarea from 'sefirot/components/SInputTextarea.vue' | ||
import { useMarkdown } from 'sefirot/composables/Markdown' | ||
import { ref } from 'vue' | ||
const title = 'Components / SInputTextarea / 02. Preview' | ||
const docs = '/components/input-textarea' | ||
const text = ref('') | ||
function state() { | ||
return { | ||
size: 'small', | ||
label: 'Label', | ||
info: 'Some helpful information.', | ||
note: 'Note text', | ||
placeholder: 'Placeholder text', | ||
help: 'This is a help text.', | ||
rows: 5, | ||
disabled: false, | ||
error: false | ||
} | ||
} | ||
const render = useMarkdown() | ||
function preview() { | ||
if (!text.value) { return 'Nothing to preview' } | ||
return render(text.value, false) | ||
} | ||
</script> | ||
|
||
<template> | ||
<Story :title="title" :init-state="state" source="Not available" auto-props-disabled> | ||
<template #controls="{ state }"> | ||
<HstSelect | ||
title="size" | ||
:options="{ | ||
mini: 'mini', | ||
small: 'small', | ||
medium: 'medium' | ||
}" | ||
v-model="state.size" | ||
/> | ||
<HstText | ||
title="label" | ||
v-model="state.label" | ||
/> | ||
<HstText | ||
title="info" | ||
v-model="state.info" | ||
/> | ||
<HstText | ||
title="note" | ||
v-model="state.note" | ||
/> | ||
<HstText | ||
title="placeholder" | ||
v-model="state.placeholder" | ||
/> | ||
<HstText | ||
title="help" | ||
v-model="state.help" | ||
/> | ||
<HstNumber | ||
title="rows" | ||
v-model="state.rows" | ||
/> | ||
<HstCheckbox | ||
title="disabled" | ||
v-model="state.disabled" | ||
/> | ||
<HstCheckbox | ||
title="error" | ||
v-model="state.error" | ||
/> | ||
</template> | ||
|
||
<template #default="{ state }"> | ||
<Board :title="title" :docs="docs"> | ||
<SInputTextarea | ||
:class="{ 'has-error': state.error }" | ||
:size="state.size" | ||
:label="state.label" | ||
:info="state.info" | ||
:note="state.note" | ||
:help="state.help" | ||
:placeholder="state.placeholder" | ||
:rows="state.rows" | ||
:disabled="state.disabled" | ||
v-model="text" | ||
:preview="preview" | ||
/> | ||
</Board> | ||
</template> | ||
</Story> | ||
</template> |