Create a new documentation component DocsExample
that allows to toggle between an example and its code
#826
Labels
category: supporting code
Implementation of the system
good first issue
Self-contained, straightforward, low-complexity
help wanted
Open source contributors welcome
P2 - normal
Priority: Nice to have
size: medium
🌱 Are you new to the codebase? Welcome! Please see the contributing guidelines.
Desired behavior
Create a new documentation component
DocsExample
that toggles between an example and its code on the documentation website.Here is one example demonstrating the expected visual output. For this
KCardGrid
demonstration (source, output), the newshould produce the following:
(1) On an initial page load, we'd only show the card grid passed via the default slot
(2) The code sample(s) related to the example would be passed via placing
DocsShowCode
(s) to#code
slot(3)
DocsExample
would render a toggle button to "View code"/"Hide code" in its top right corner. Clicking it would show/hide the code sample(s) above the card grid:The overall experience would be similar to that of the Vuetify documentation:
Current behavior
Right now we show code above or below the example, or not at all, and there is no way to toggle it.
The Value Add
Guidance
DocsShow
andDocsShowCode
and how they are used on documentation pages:DocsExample
that produces the "Desired behavior"DocsShow
to render the exampleDocsShowCode
since in some situations, we need to provide more code snippets in different languages related to one example. Therefore,DocsShowCode
will be provided from outside as demonstrated above.DocsShow
andDocsShowCode
to not cause regressions in the current documentation websiteOut of scope
At this stage, we only want to focus on creating
DocsExample
and using it at one place to demonstrate it works. Please do not refactor all examples on all website pages with it.Acceptance criteria
DocsExample
documentation component as specified aboveDocsExample
internally utilizesDocsShow
DocsExample
internally doesn't utilizeDocsShowCode
but rather receives it via the#code
slotDocsExample
can render multipleDocsShowCode
snippets in various languagesDocsShow
andDocsShowCode
DocsExample
is used in the givenKCardGrid
documentation exampleThe text was updated successfully, but these errors were encountered: