Skip to content

Commit 43e575f

Browse files
committed
feat(website): add Tabs ui qwik component
1 parent 26b27f8 commit 43e575f

24 files changed

+415
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * as Tabs from './tabs';
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export type { TabsContentProps } from './tabs-content.types';
2+
export { TabsContent } from './tabs-content';
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { cva } from 'class-variance-authority';
2+
3+
export const tabsContentStyles = cva([
4+
'focus:outline-none',
5+
'focus-visible:outline',
6+
'focus-visible:outline-2',
7+
'focus-visible:outline-primary-focus',
8+
]);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { TabsContentProps } from './tabs-content.types';
2+
import { component$, Slot } from '@builder.io/qwik';
3+
import { Tabs } from 'qwik-primitives';
4+
import { twm } from '@/utilities/twm';
5+
import { tabsContentStyles } from './tabs-content.styles';
6+
7+
export const TabsContent = component$<TabsContentProps>((props) => {
8+
const { class: className, ...others } = props;
9+
10+
return (
11+
<Tabs.Content class={twm(tabsContentStyles(), className)} {...others}>
12+
<Slot />
13+
</Tabs.Content>
14+
);
15+
});
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import type { PropsOf, FunctionComponent, CSSProperties } from '@builder.io/qwik';
2+
3+
export interface TabsContentProps extends PropsOf<'div'> {
4+
/**
5+
* Change the default rendered element for the one passed as, merging their props and behavior.
6+
*
7+
* Read our [Composition](https://github.com/ZAHON/qwik-primitives/blob/main/packages/primitives/docs/composition.md) guide for more details.
8+
*/
9+
as?: FunctionComponent;
10+
11+
/**
12+
* A unique value that associates the content with a trigger.
13+
*/
14+
value: string;
15+
16+
/**
17+
* The CSS class for the element.
18+
*/
19+
class?: string;
20+
21+
/**
22+
* The inline style for the element.
23+
*/
24+
style?: CSSProperties;
25+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export type { TabsContextValue } from './tabs-context.types';
2+
export { TabsContext } from './tabs-context';
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import type { TabsContextValue } from './tabs-context.types';
2+
import { createContextId } from '@builder.io/qwik';
3+
4+
export const TabsContext = createContextId<TabsContextValue>('tabs-context');
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export interface TabsContextValue {
2+
/**
3+
* The size of the tabs.
4+
*/
5+
size: '1' | '2';
6+
7+
/**
8+
* The color of the tabs.
9+
*/
10+
color: 'default' | 'primary';
11+
12+
/**
13+
* Uses a higher contrast color for the tabs.
14+
*/
15+
highContrast: boolean;
16+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export type { TabsListProps } from './tabs-list.types';
2+
export { TabsList } from './tabs-list';
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { cva } from 'class-variance-authority';
2+
3+
export const tabsListStyles = cva([
4+
'flex',
5+
'justify-start',
6+
'whitespace-nowrap',
7+
'border-b',
8+
'border-default-6',
9+
10+
'focus:outline-none',
11+
'focus-visible:outline',
12+
'focus-visible:outline-2',
13+
'focus-visible:outline-primary-focus',
14+
]);

0 commit comments

Comments
 (0)