mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-01-31 21:56:06 +00:00
feat(breadcrumb): separate to container and element components
This commit is contained in:
parent
b65bf26127
commit
7123388306
@ -1,25 +1,19 @@
|
|||||||
import { Text } from '@status-im/components'
|
|
||||||
import { ChevronRightIcon } from '@status-im/icons'
|
|
||||||
import { XStack } from 'tamagui'
|
import { XStack } from 'tamagui'
|
||||||
|
import BreadcrumbElement from './BreadcrumbElement'
|
||||||
|
|
||||||
type BreadcrumbBarProps = {
|
type BreadcrumbProps = {
|
||||||
breadcrumbList: string[]
|
breadcrumbList: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const Breadcrumb = ({ breadcrumbList }: BreadcrumbBarProps) => {
|
const Breadcrumb = ({ breadcrumbList }: BreadcrumbProps) => {
|
||||||
return (
|
return (
|
||||||
<XStack space={'$2'} alignItems="center">
|
<XStack space={'$2'} alignItems="center">
|
||||||
{breadcrumbList.map((item, index) => {
|
{breadcrumbList.map((element, index) => (
|
||||||
const isNotLast = index !== breadcrumbList.length - 1
|
<BreadcrumbElement
|
||||||
return (
|
element={element}
|
||||||
<XStack space={'$2'} alignItems="center" key={index}>
|
isLastElement={index === breadcrumbList.length - 1}
|
||||||
<Text size={15} color={isNotLast ? '#647084' : ''}>
|
/>
|
||||||
{item}
|
))}
|
||||||
</Text>
|
|
||||||
{isNotLast && <ChevronRightIcon size={20} color="#647084" />}
|
|
||||||
</XStack>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</XStack>
|
</XStack>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
26
src/components/General/Breadcrumb/BreadcrumbElement.tsx
Normal file
26
src/components/General/Breadcrumb/BreadcrumbElement.tsx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import { Text } from '@status-im/components'
|
||||||
|
import { ChevronRightIcon } from '@status-im/icons'
|
||||||
|
import { XStack } from 'tamagui'
|
||||||
|
|
||||||
|
type BreadcrumbElementProps = {
|
||||||
|
element: string
|
||||||
|
isLastElement: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const BreadcrumbElement = ({
|
||||||
|
element,
|
||||||
|
isLastElement,
|
||||||
|
}: BreadcrumbElementProps) => {
|
||||||
|
return (
|
||||||
|
<XStack space={'$2'} alignItems="center">
|
||||||
|
<Text size={15} color={isLastElement ? '' : '#647084'}>
|
||||||
|
{element}
|
||||||
|
</Text>
|
||||||
|
{isLastElement === false && (
|
||||||
|
<ChevronRightIcon size={20} color="#647084" />
|
||||||
|
)}
|
||||||
|
</XStack>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BreadcrumbElement
|
Loading…
x
Reference in New Issue
Block a user