-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate KTabList examples to DocsExample #956
base: develop
Are you sure you want to change the base?
Migrate KTabList examples to DocsExample #956
Conversation
Welcome and thanks @mukulpythondev, we will review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mukulpythondev for the contribution. I have added some comments as a preliminary review. Also it seems like all the files changed in this PR have not been properly linted. You can use the command yarn run lint-fix
after making the necessary changes to automatically fix the formatting in all of the files. This would also help the CI/CD to pass before the final review.
Thanks for your contribution.
<div | ||
:style="{ | ||
backgroundColor: $themePalette.grey.v_700, | ||
padding: '10px 20px', | ||
color: $themeTokens.textInverted, | ||
display:'inline-block' | ||
}" | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we adding this custom styling to this particular example? As far as I understand, we want to show the styling capabilities of the props in this example, and thus adding styles to the parent div
kind of distracts the focus from the same.
Can we remove this parent div
completely and just keep the KTabsList
component in the template?
@@ -0,0 +1,35 @@ | |||
<template> | |||
<div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the wrapping div
since it's empty anyhow (has no styling or functionality associated with it)?
@@ -0,0 +1,38 @@ | |||
<template> | |||
<div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about wrapping empty div
.
docs/examples/KTabsList/Intro.vue
Outdated
@@ -0,0 +1,29 @@ | |||
<template> | |||
<div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
docs/pages/ktabslist.vue
Outdated
export default { | ||
name: 'DocsKTabsList', | ||
data() { | ||
return { | ||
tabs: [ | ||
{ id: 'tabLessons', label: 'Lessons' }, | ||
{ id: 'tabLearners', label: 'Learners' }, | ||
{ id: 'tabGroups', label: 'Groups' }, | ||
], | ||
ex1activeTabId: 'tabLessons', | ||
icons: { | ||
tabLessons: 'lesson', | ||
tabLearners: 'person', | ||
tabGroups: 'people', | ||
}, | ||
}; | ||
}, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove all these exported data members (as all of the examples and the code needed to run them has been migrated to individual files)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the changes @mukulpythondev. They all seem on the right track and very close to as we would finally like them. I have left some minor comments, and would love it it you can address them.
Also the changes right now do not seem to be linted. Please do run the linting script to autofix all of them for you!
Feel free to request a review after making all the changes, or ask for clarifications if you need any. Thanks again for all your work.
|
||
export default { | ||
data() { | ||
return sharedExampleData; // Use shared data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thinking here @mukulpythondev trying to minimise the code duplication across examples.
I would welcome this change if it were in some other part of the codebase, but here I feel the verbosity of having the data copied in each example file it worth it. There are actually a couple of reasons for it:
- The whole point of these documentation examples is to be standalone and capable of independent rendering. If we reference constants from other files, the same defeats the spirit of the same.
- If we add the tab data to each example, then the documentation viewers would actually see that data, it's structure and it's direct correspondance with the component when they view the script part of the example. However if we make use of an import like this, the actual structure of the imported data may never visible to them, which would kind of defeat the purpose of this documentation.
Thus I would favour the copying and pasting of the shared data in each of the examples seperately.
|
||
|
||
<script> | ||
import { sharedExampleData } from '../../pages/ktabslist.vue'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
|
||
|
||
<script> | ||
import { sharedExampleData } from '../../pages/ktabslist.vue'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
docs/examples/KTabsList/Intro.vue
Outdated
|
||
|
||
<script> | ||
import { sharedExampleData } from '../../pages/ktabslist.vue'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
:activeTabId="ex1activeTabId" | ||
/> | ||
</DocsShow> | ||
<DocsExample |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We recently merged #965 into the codebase which make changes to the way the DocsExample component renders. You may need to add the 'block' attribute to the same post the migration to preserve the look of the page.
Please do pull the latest changes from the KDS repository and then make the next set of changes to avoid any merge conflicts.
d094d28
to
0461531
Compare
Hi @mukulpythondev, just checking in, is all feedback resolved or would you need more time? |
@MisRob All fix and working fine only 1 UI difference one background color because first i do with directly with the css but it is not aligning with our previous code and i can not find any method to do that. |
Description
This PR migrates the
KTabsList
documentation to use theDocsExample
component for better structure and maintainability. The change ensures that examples are properly organized while keeping the documentation concise and functional.Issue addressed
Addresses #953
Before/after screenshots
Before:




After:


Changelog
KTabsList
documentation to useDocsExample
.KTabsList
documentation to useDocsExample
component #953KTabsList
documentation.Steps to test
KTabsList
documentation page.DocsExample
.(Optional) Implementation notes
At a high level, how did you implement this?
docs/examples/KTabsList/
directory.DocsExample
component.Does this introduce any tech-debt items?
No.
Testing checklist
Reviewer guidance
DocsExample
?Comments
(Any additional notes for the reviewer.)