Skip to content

Instantly share code, notes, and snippets.

@ajbouh
Created August 10, 2021 03:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajbouh/c986d63d7241437cdb93fc50d9435135 to your computer and use it in GitHub Desktop.
Save ajbouh/c986d63d7241437cdb93fc50d9435135 to your computer and use it in GitHub Desktop.
<style>
.container :global(.deprecated) {
font-weight: bold;
color: crimson;
}
.container :global(.deprecated p) {
margin-top: 0;
}
</style>
<script>
import { Field } from './model';
import DescriptionView from './DescriptionView.svelte';
import DeprecatedView from './DeprecatedView.svelte';
import FieldSyntaxView from './FieldSyntaxView.svelte';
import TypeRefView from './TypeRefView.svelte';
import FieldArgumentsTableView from './FieldArgumentsTableView.svelte';
export let typeName
export let field
export let pagePath
export let fieldPath
export let showArguments = true
$: console.log("FieldView", {pagePath})
</script>
<div class="container pt-4 pb-6 border-t border-gray-200" id={fieldPath} name={fieldPath}>
<h3 class="text-md font-medium mb-2"><span class="text-gray-400">{typeName}.</span>{field.name}<!--<span class="text-gray-400">: <TypeRefView {pagePath} typeRef={field.type} /></span>--></h3>
<FieldSyntaxView {pagePath} {field} />
{#if field.description}
<DescriptionView class="description" description={field.description} />
{/if}
{#if field.isDeprecated}
<DescriptionView class="deprecated" deprecated={field.deprecationReason} />
{/if}
{#if showArguments && field.args.length}
<h5 class="text-md font-medium text-gray-600 py-2 mt-2">Arguments</h5>
<FieldArgumentsTableView {pagePath} {fieldPath} args={field.args} />
{/if}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment