
        <script setup>
        import { computed } from "vue"
        import { Example, PropsTable, PageTitle } from "@viteplay/vue"
        import { useRoute, useRouter } from "vue-router"
            
        let componentProps = {"CButton":[{"name":"p_Label","type":"string","required":false,"desc":"ボタン内のテキストを設定\n@example p_Label: '登録完了'"},{"name":"disabled","type":"boolean","required":false,"desc":"ボタンの有効無効の切り替え\n@example disabled: false"},{"name":"p_BtnType","type":"string","required":false,"desc":"ボタンのtype指定（ボタンの色が個別で持てないため、classを複数作成して対応）\ntypeを追加する際はp_BtnTypeのvalidatorにクラス名を追加し、同名のクラスを作成した上で使用すること\n使用するプロジェクトにて\n:root{\n--c-Bgタイプ名:背景;\n--c-Colorタイプ名: 文字色;\n}\nの形で表記して色を指定する。\n* ※varなので複数ファイルで同名のカスタムプロパティを宣言すると競合するので注意\n@example p_BtnType: primary, secondary, negative, positive"}]}
        let route = useRoute()
        let router = useRouter()
        let focusId = computed(() => route.query.focus && route.hash.slice(1))
        let shouldRender = (slug) => {
          return !route.query.focus || slug === focusId.value
        }
        let hiddenCount = computed(() => {
          return ["basic","kind-primary","disable"].filter((slug) => !shouldRender(slug)).length
        })

        let showAll = () => {
          router.push({ query: {}, hash: route.hash })
        }

        let openInEditor = (file) => {
           fetch('/__open-in-editor?file=' + encodeURIComponent(file))
        }
        let examples = [
          {
                title: "Basic",
                slug: "basic",
                docs: {"content":"","attrs":{}},
                // encodeURI because the example will contain html tags
                // which will cause this component to be incorrectly parsed
                code: decodeURI("%3Cscript%20setup%3E%0Aimport%20CButton%20from%20'../CButton.vue'%0Aconst%20alertTest%20=%20()%20=%3E%20%7B%0A%20%20alert('test')%0A%7D%0A%3C/script%3E%0A%0A%3Ctemplate%3E%0A%20%20%3CCButton%20p_Label=%22%E4%BF%9D%E5%AD%98%E7%A2%BA%E8%AA%8D%22%20@click=%22alertTest%22%20:disabled=%22false%22%20p_BtnType=%22primary%22%20/%3E%0A%3C/template%3E%0A%3Cstyle%3E%0A:root%20%7B%0A%20%20--q-primary:%20linear-gradient(to%20right,%20#f5abdf,%20#de37a6);%0A%7D%0A%3C/style%3E"),
                iframeUrl: "/__iframe/CButton-basic.html",
                openInEditor: import.meta.env.DEV 
                  ? () => openInEditor("/Users/nakashimakeiju/ghq/github.com/CodeLic/console/src/components/CButton/examples/Basic.vue") 
                  : undefined 
              },{
                title: "Kind - Primary",
                slug: "kind-primary",
                docs: {"content":"","attrs":{}},
                // encodeURI because the example will contain html tags
                // which will cause this component to be incorrectly parsed
                code: decodeURI("%3Cscript%20setup%3E%0Aimport%20CButton%20from%20'../CButton.vue'%0A%3C/script%3E%0A%0A%3Ctemplate%3E%0A%20%20%3CCButton%20p_Label=%22%E3%81%93%E3%81%A1%E3%82%89%E3%82%92%E6%8A%BC%E3%81%97%E3%81%A6%22%20p_BtnType=%22secondary%22%20/%3E%0A%3C/template%3E%0A%0A%3Cstyle%20scoped%3E%0A:root%20%7B%0A%20%20--q-secondary:%20#3c4d58;%0A%20%20--q-accent:%20#ffffff;%0A%7D%0A%3C/style%3E"),
                iframeUrl: "/__iframe/CButton-kind-primary.html",
                openInEditor: import.meta.env.DEV 
                  ? () => openInEditor("/Users/nakashimakeiju/ghq/github.com/CodeLic/console/src/components/CButton/examples/Kind - Primary.vue") 
                  : undefined 
              },{
                title: "disable",
                slug: "disable",
                docs: {"content":"","attrs":{}},
                // encodeURI because the example will contain html tags
                // which will cause this component to be incorrectly parsed
                code: decodeURI("%3Cscript%20setup%3E%0Aimport%20CButton%20from%20'../CButton.vue'%0Aconst%20alertTest%20=%20()%20=%3E%20%7B%0A%20%20alert('test')%0A%7D%0A%3C/script%3E%0A%0A%3Ctemplate%3E%0A%20%20%3CCButton%20p_Label=%22%E4%BF%9D%E5%AD%98%E7%A2%BA%E8%AA%8D%22%20@click=%22alertTest%22%20:disabled=%22true%22%20p_BtnType=%22primary%22%20/%3E%0A%3C/template%3E%0A%3Cstyle%3E%0A:root%20%7B%0A%20%20--q-primary:%20linear-gradient(to%20right,%20#f5abdf,%20#de37a6);%0A%7D%0A%3C/style%3E"),
                iframeUrl: "/__iframe/CButton-disable.html",
                openInEditor: import.meta.env.DEV 
                  ? () => openInEditor("/Users/nakashimakeiju/ghq/github.com/CodeLic/console/src/components/CButton/examples/disable.vue") 
                  : undefined 
              }
        ]
        </script>
        <template>
          <PageTitle title="CButton" :openInEditor="() => openInEditor('/Users/nakashimakeiju/ghq/github.com/CodeLic/console/src/components/CButton/CButton.vue')" />
          <div v-if="hiddenCount > 0" class="hidden-examples-info">
            {{ hiddenCount }} example{{ hiddenCount > 1 ? "s" : null }} hidden, <a class="viteplay-link" type="button" @click.prevent="showAll">show all</a>
          </div>
          <PropsTable componentName="CButton" :componentProps="componentProps" />
          <template  
            v-for="example in examples" 
            :key="example.slug">
            <Example 
              v-if="shouldRender(example.slug)"
              :example="example" 
              :componentProps="componentProps" />
          </template>
        </template>

<style scoped>
.hidden-examples-info {
  margin: 20px 0;
}
</style>
      