-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make the studio not break for some edge cases * Implement breadcrumbs * Add changeset
- Loading branch information
Showing
7 changed files
with
113 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@vygruppen/spor-react": minor | ||
--- | ||
|
||
New components: Breadcrumb, BreadcrumbItem and BreadcrumbLink |
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,37 @@ | ||
import { | ||
Breadcrumb as ChakraBreadcrumb, | ||
BreadcrumbItem as ChakraBreadcrumbItem, | ||
BreadcrumbLink as ChakraBreadcrumbLink, | ||
BreadcrumbProps as ChakraBreadcrumbProps, | ||
} from "@chakra-ui/react"; | ||
import { DropdownRightFill18Icon } from "@vygruppen/spor-icon-react"; | ||
import React from "react"; | ||
|
||
type BreadcrumbProps = ChakraBreadcrumbProps; | ||
/** | ||
* A breadcrumb component. | ||
* | ||
* Used to create customizable breadcrumbs. | ||
* | ||
* ```tsx | ||
* <Breadcrumb> | ||
* <BreadcrumbItem> | ||
* <BreadcrumbLink href="/">Home</BreadcrumbLink> | ||
* </BreadcrumbItem> | ||
* <BreadcrumbItem isCurrentPage={true}> | ||
* <BreadcrumbLink href="/about">About</BreadcrumbLink> | ||
* </BreadcrumbItem> | ||
* </Breadcrumb> | ||
* ``` | ||
*/ | ||
export const Breadcrumb = (props: BreadcrumbProps) => { | ||
return ( | ||
<ChakraBreadcrumb | ||
separator={<DropdownRightFill18Icon color="blackAlpha.400" />} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
export const BreadcrumbItem = ChakraBreadcrumbItem; | ||
export const BreadcrumbLink = ChakraBreadcrumbLink; |
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 @@ | ||
export * from "./Breadcrumb"; |
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,47 @@ | ||
import { breadcrumbAnatomy as parts } from "@chakra-ui/anatomy"; | ||
import { | ||
createMultiStyleConfigHelpers, | ||
defineStyle, | ||
} from "@chakra-ui/styled-system"; | ||
import { getBoxShadowString } from "../utils/box-shadow-utils"; | ||
|
||
const { defineMultiStyleConfig, definePartsStyle } = | ||
createMultiStyleConfigHelpers(parts.keys); | ||
|
||
const baseStyleLink = defineStyle({ | ||
transitionProperty: "common", | ||
transitionDuration: "fast", | ||
transitionTimingFunction: "ease-out", | ||
outline: "none", | ||
color: "inherit", | ||
textDecoration: "none", | ||
"&:not([aria-current=page])": { | ||
cursor: "pointer", | ||
paddingX: 0.5, | ||
borderRadius: "xs", | ||
_hover: { | ||
backgroundColor: "coralGreen", | ||
}, | ||
_focusVisible: { | ||
boxShadow: getBoxShadowString({ | ||
borderColor: "greenHaze", | ||
borderWidth: 2, | ||
}), | ||
}, | ||
_active: { | ||
backgroundColor: "mint", | ||
}, | ||
}, | ||
}); | ||
|
||
const baseStyle = definePartsStyle({ | ||
link: baseStyleLink, | ||
list: { | ||
flexWrap: "wrap", | ||
alignItems: "flex-start", | ||
}, | ||
}); | ||
|
||
export default defineMultiStyleConfig({ | ||
baseStyle, | ||
}); |
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