mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-01-31 13:46:23 +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 BreadcrumbElement from './BreadcrumbElement'
|
||||
|
||||
type BreadcrumbBarProps = {
|
||||
type BreadcrumbProps = {
|
||||
breadcrumbList: string[]
|
||||
}
|
||||
|
||||
const Breadcrumb = ({ breadcrumbList }: BreadcrumbBarProps) => {
|
||||
const Breadcrumb = ({ breadcrumbList }: BreadcrumbProps) => {
|
||||
return (
|
||||
<XStack space={'$2'} alignItems="center">
|
||||
{breadcrumbList.map((item, index) => {
|
||||
const isNotLast = index !== breadcrumbList.length - 1
|
||||
return (
|
||||
<XStack space={'$2'} alignItems="center" key={index}>
|
||||
<Text size={15} color={isNotLast ? '#647084' : ''}>
|
||||
{item}
|
||||
</Text>
|
||||
{isNotLast && <ChevronRightIcon size={20} color="#647084" />}
|
||||
</XStack>
|
||||
)
|
||||
})}
|
||||
{breadcrumbList.map((element, index) => (
|
||||
<BreadcrumbElement
|
||||
element={element}
|
||||
isLastElement={index === breadcrumbList.length - 1}
|
||||
/>
|
||||
))}
|
||||
</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