-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d535c5
commit 2b890cb
Showing
27 changed files
with
463 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.saltTabBar { | ||
display: flex; | ||
align-items: center; | ||
flex-direction: row; | ||
gap: var(--salt-spacing-100); | ||
position: relative; | ||
box-sizing: border-box; | ||
} | ||
|
||
.saltTabBar-separator::before { | ||
content: ""; | ||
position: absolute; | ||
inset: auto 0 0 0; | ||
height: var(--salt-size-border); | ||
border-bottom: var(--salt-size-border) var(--salt-separable-borderStyle) var(--salt-separable-secondary-borderColor); | ||
} | ||
|
||
.saltTabBar-padding { | ||
padding-left: var(--salt-spacing-300); | ||
padding-right: var(--salt-spacing-300); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { useComponentCssInjection } from "@salt-ds/styles"; | ||
import { useWindow } from "@salt-ds/window"; | ||
import { type ComponentPropsWithRef, forwardRef } from "react"; | ||
|
||
import { makePrefixer } from "@salt-ds/core"; | ||
import { clsx } from "clsx"; | ||
import tabBarCss from "./TabBar.css"; | ||
|
||
export interface TabBarProps extends ComponentPropsWithRef<"div"> { | ||
separator?: boolean; | ||
padding?: boolean; | ||
} | ||
|
||
const withBaseName = makePrefixer("saltTabBar"); | ||
|
||
export const TabBar = forwardRef<HTMLDivElement, TabBarProps>( | ||
function TabBar(props, ref) { | ||
const { className, children, separator, padding, ...rest } = props; | ||
|
||
const targetWindow = useWindow(); | ||
useComponentCssInjection({ | ||
testId: "salt-tab-bar", | ||
css: tabBarCss, | ||
window: targetWindow, | ||
}); | ||
|
||
return ( | ||
<div | ||
className={clsx( | ||
withBaseName(), | ||
{ | ||
[withBaseName("separator")]: separator, | ||
[withBaseName("padding")]: padding, | ||
}, | ||
className, | ||
)} | ||
{...rest} | ||
ref={ref} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.