Skip to content

Commit

Permalink
feat: adds function reference
Browse files Browse the repository at this point in the history
  • Loading branch information
justin-schroeder committed Feb 3, 2024
1 parent c09ba99 commit e37aa50
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/components/FunctionReference.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script lang="ts" setup>
const props = defineProps<{
function: string
arguments: Array<{ name: string; type: string; comment?: string }>
return: string
}>()
</script>

<template>
<div class="bg-white rounded-lg p-3 font-mono text-base mb-8">
<span class="text-blue-700">function </span>
<span class="text-fuchsia-700">{{ props.function }}</span
>(<br /><template v-for="(arg, index) in props.arguments" :key="arg.name">
<div class="ml-4">
<span class="text-fuchsia-700">{{ arg.name }}</span
>: <span class="text-sky-500">{{ arg.type }}</span
>{{ index < props.arguments.length - 1 ? ", " : ""
}}<span v-if="arg.comment" class="text-gray-400"
>// {{ arg.comment }}</span
>
</div> </template
>): <span class="text-sky-500">{{ props.return }}</span>
</div>
</template>
13 changes: 13 additions & 0 deletions docs/components/content/Format.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ import { format } from "@formkit/tempo"
<template>
<PageSection id="format">
<HeadingSection title="Format" class="text-sky-500" />
<FunctionReference
function="format"
:arguments="[
{
name: 'date',
type: 'Date | string',
comment: 'strings must be ISO 8601',
},
{ name: 'format', type: 'string | object' },
{ name: 'locale?', type: 'string' },
]"
return="string"
/>
<p>Tempo’s <code>format()</code> function output’s dates in two ways:</p>
<ul class="jump-list">
<li>
Expand Down

0 comments on commit e37aa50

Please sign in to comment.