-
Notifications
You must be signed in to change notification settings - Fork 25
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
107f77f
commit a20f724
Showing
8 changed files
with
103 additions
and
4 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
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 clsx from "clsx"; | ||
import styles from "./styles.module.css"; | ||
import { useMemo } from "react"; | ||
|
||
type Props = { | ||
examples: Array<{ image: string; description: string; link: string }>; | ||
}; | ||
|
||
const numberPerRow = 2; | ||
|
||
export const ExampleUsageGrid = (props: Props) => { | ||
const rows = useMemo(() => { | ||
return props.examples.reduce((acc, example) => { | ||
const newRow = Number.isInteger(acc.length / numberPerRow); | ||
if (newRow) { | ||
acc.push([example]); | ||
} else { | ||
acc[acc.length - 1].push(example); | ||
} | ||
return acc; | ||
}, [] as Array<Props["examples"]>); | ||
}, [props.examples]); | ||
|
||
return ( | ||
<div> | ||
{rows.map((row) => ( | ||
<div className="row"> | ||
{row.map((col) => ( | ||
<div className={clsx("col col--6")}> | ||
<a href={col.link} target="_blank"> | ||
<div className={styles.exampleCard}> | ||
<img src={col.image} alt={col.description} /> | ||
<div className={styles.exampleCardBody}> | ||
{col.description} | ||
</div> | ||
</div> | ||
</a> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.exampleCard { | ||
background-color: rgb(245, 245, 245); | ||
box-shadow: 0px 0px 10px rgba(10, 10, 10, 0.2); | ||
margin-bottom: 20px; | ||
border-radius: 4px; | ||
overflow: hidden; | ||
|
||
&:hover { | ||
box-shadow: 0px 0px 5px rgba(10, 10, 10, 0.1); | ||
} | ||
|
||
img { | ||
max-width: 100%; | ||
aspect-ratio: 4/2; | ||
width: 100%; | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
background-size: cover; | ||
} | ||
} | ||
|
||
[data-theme="dark"] { | ||
.exampleCard { | ||
background-color: var(--ifm-navbar-background-color); | ||
} | ||
} | ||
|
||
.exampleCardBody { | ||
padding: 10px; | ||
text-align: center; | ||
font-weight: bold; | ||
} |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export * from "./DailyExplorer"; | ||
export * from "./DailyReportStatsLabel"; | ||
export * from "./ExampleUsageGrid"; | ||
export * from "./ExternalLinkButton"; | ||
export * from "./JSONFileLinks"; | ||
export * from "./KilledListCountLabel"; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.