-
Notifications
You must be signed in to change notification settings - Fork 2
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
eee525e
commit 52bf105
Showing
2 changed files
with
52 additions
and
55 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,44 @@ | ||
import React, { useRef, useEffect, useCallback } from 'react'; | ||
|
||
import { BiggestNamespaceResults } from '../../../types'; | ||
|
||
type Props = { | ||
namespaces: BiggestNamespaceResults[] | undefined; | ||
selectedNamespace: string | undefined; | ||
handleSelectNamespace: (selectedNamespace: string) => void; | ||
}; | ||
|
||
export const NamespaceGrid = (props: Props) => { | ||
const { | ||
namespaces, | ||
selectedNamespace, | ||
handleSelectNamespace | ||
} = props; | ||
|
||
return ( | ||
<div className="row mt-1"> | ||
<div className="col-12 col-lg-10 offset-lg-1"> | ||
<div className="row row-cols-1 row-cols-sm-3 row-cols-xl-5 g-lg-4 g-3"> | ||
{namespaces && ( | ||
Object.values(namespaces).map((item, index: number) => ( | ||
<div key={index} className="col"> | ||
<div className={`card h-100 shadow-sm position-relative cursor-pointer ${item?.namespace === selectedNamespace ? 'bg-primary-subtle' : 'bg-body-tertiary namespace-card'}`}> | ||
<div className="card-body text-center d-flex flex-column justify-content-center"> | ||
<p className={`card-title mt-2 text-primary-emphasis ${item?.namespace === selectedNamespace ? 'fw-bold' : 'fw-semibold'}`}> | ||
<a className='text-decoration-none text-reset stretched-link' onClick={() => handleSelectNamespace(item?.namespace)}> | ||
{index + 1}. {item?.namespace} | ||
</a> | ||
</p> | ||
<p className={`card-text mb-2 text-sm ${item?.namespace === selectedNamespace ? 'fw-medium' : 'fw-normal'}`}> | ||
{item?.number_of_projects} Projects | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
)) | ||
)} | ||
</div> | ||
</div> | ||
</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