generated from taylorbryant/gatsby-starter-tailwind
-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move navbar files to component dir
- Loading branch information
viet nguyen
committed
Feb 22, 2024
1 parent
1c92436
commit 48840ba
Showing
4 changed files
with
74 additions
and
62 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
src/app/(default)/editArea/[slug]/components/AreaAttributesPanel.tsx
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,58 @@ | ||
'use client' | ||
import { EntityIcon, EType } from '../general/components/AreaItem' | ||
import { SidebarNavProps } from './SidebarNav' | ||
|
||
/** | ||
* Show area attributes in a small panel | ||
*/ | ||
export const AreaAttributesPanel: React.FC<Omit<SidebarNavProps, 'slug'>> = ({ canAddAreas, canAddClimbs, areaCount, climbCount, isLeaf, isBoulder }) => { | ||
let type: EType | ||
if (isLeaf) { | ||
type = isBoulder ? 'boulder' : 'crag' | ||
} else { | ||
type = 'area' | ||
} | ||
return ( | ||
<section> | ||
<p className='pl-4 pb-1 font-semibold text-secondary text-sm uppercase'>Area attributes</p> | ||
|
||
<div className='bg-base-100 rounded-box border p-4'> | ||
<div className='flex flex-col gap-3 text-base-300 text-xs w-full '> | ||
|
||
<div className='flex items-center gap-2 justify-between'> | ||
<span className='text-scondary'>Entity type</span> <span className='text-primary font-semibold'><EntityIcon type={type} size={16} /></span> | ||
</div> | ||
|
||
<hr /> | ||
|
||
<div className='flex items-center gap-2 justify-between'> | ||
<span className='text-scondary'>Crag</span> <span className='text-primary font-semibold'>{booleanToYesNo(isLeaf)}</span> | ||
</div> | ||
<div className='flex items-center gap-2 justify-between'> | ||
<span className='text-scondary'>Boulder</span> <span className='text-primary font-semibold'>{booleanToYesNo(isBoulder)}</span> | ||
</div> | ||
|
||
<hr /> | ||
|
||
<div className='flex items-center gap-2 justify-between'> | ||
<span className='text-scondary'>Child areas</span> <span className='text-primary font-semibold'>{areaCount}</span> | ||
</div> | ||
<div className='flex items-center gap-2 justify-between'> | ||
<span className='text-scondary'>Climbs</span> <span className='text-primary font-semibold'>{climbCount}</span> | ||
</div> | ||
|
||
<hr /> | ||
|
||
<div className='flex items-center gap-2 justify-between'> | ||
<span className='text-scondary'>Can add child areas?</span> <span className='text-primary font-semibold'>{booleanToYesNo(canAddAreas)}</span> | ||
</div> | ||
<div className='flex items-center gap-2 justify-between'> | ||
<span className='text-scondary'>Can add climbs?</span> <span className='text-primary font-semibold'>{booleanToYesNo(canAddClimbs)}</span> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
) | ||
} | ||
|
||
const booleanToYesNo = (bool: boolean): string => bool ? 'YES' : 'NO' |
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