Skip to content
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

Macgeargear/sucu 68 component tab #8

Merged
merged 15 commits into from
Sep 14, 2024

Conversation

macgeargear
Copy link
Contributor

@macgeargear macgeargear commented Sep 13, 2024

Type of Change

  • New features
  • Bug fixes
  • Breaking changes
  • Refactor
  • Documentation updates
  • Other (please specify):

Description

  • Create Tabs component

Tabs context

  • to share the state of tabs

Tabs Component

<TabsRoot> // init the tabs context and wraps all tab components
  <TabsList> // container for tabs trigger
    <TabsTrigger /> // updates the active tabs when clicked
  </TabsList> 
  <TabsContent /> // display its content
</TabsRoot>

Usage

<TabsRoot defaultActiveTab="all"> // you can specify the default active tab here
	<TabsList>
		<TabsTrigger value="all">ทั้งหมด</TabsTrigger>
		<TabsTrigger value="sgcu">อบจ.</TabsTrigger>
		<TabsTrigger value="sccu">สภานิสิต</TabsTrigger>
	</TabsList>

	<TabsContent value="all">
		<p>This is the all tab content.</p> // add the tab content here
	</TabsContent>
	<TabsContent value="sgcu">
		<p>This is the sgcu tab content.</p>
	</TabsContent>
	<TabsContent value="sccu">
		<p>This is the sccu tab content.</p>
	</TabsContent>
</TabsRoot>

Screenshots or GIFs (if applicable)

Desktop

Screen.Recording.2024-09-13.at.2.23.02.PM.mov

Mobile

Screen.Recording.2024-09-13.at.2.34.38.PM.mov

@macgeargear
Copy link
Contributor Author

macgeargear commented Sep 13, 2024

I don't know what transition should be applied, so I randomly use slide 🤡

Copy link
Collaborator

@Chulinuwu Chulinuwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😻😻😻😻 component working alright AAA

src/lib/components/Tabs/tabsContext.ts Outdated Show resolved Hide resolved
src/lib/components/Tabs/TabsTrigger.svelte Outdated Show resolved Hide resolved
@macgeargear
Copy link
Contributor Author

I add the custom class props for each tab components

Copy link
Member

@punchanabu punchanabu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@punchanabu
Copy link
Member

merge dev ก่อนนะ

@macgeargear macgeargear merged commit 9c988f2 into dev Sep 14, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants