* upgrade primer/react * upgrade * using deprecated * remove lib" * Upgrade primer/react: Upgrade Label (#28502) update Label to primer/react 35.2.2 * fix merge conflicts * primer/react v35: update ActionList (#28467) * Update to v35 ActionList for LearningTrack * Update to v35 ActionList for ArticleList * Update to v35 ActionList for ProductArticleList * Update to v35 ActionList for TableOfContents * Update to v35 ActionList for ProductCollapsibleSection * Update to v35 ActionList for RestCollapsibleSection * Update to v35 ActionList for SidebarHomepage * Update to v35 ActionList for MiniTocs * Update to v35 ActionList for Search * Extra div for rendering test * One less div for rendering test * All the style updates for v35 ActionList * Works without setting as an li which is already the default (didn't before for some reason) * Use deprecated ItemInput for now * Picker update for primer/react (#28485) * update picker * inline picker for mobile * set width to auto * Update components/ui/Picker/Picker.tsx Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com> * update * Update Picker.tsx * update onselect * checking language code * move language cookie setting to language picker Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com> * Resolve package merge conflicts * fresh npm install * Primer update UnderlineNav (#28582) * update underlinenav for primer/react update * update tests * update switches test * update one last label * update header test" * remove href in underlinenav * update rendering tests * update cursor * primer/react v35: update DropDownMenu to ActionMenu (#28576) * Update to v35 ActionMenu for ArticleCards * Update to v35 ActionMenu for Search * Set button to inline-block * Put the props on the overlay * Update test for ActionMenu markup * update package * update package lock * primer/react v35: CodeLanguagePicker update from SelectMenu to ActionMenu (#28625) * Use octicon for menu down arrow * Update to v35 ActionMenu for CodeLanguagePicker * update to SubNav Co-authored-by: Grace Park <gracepark@github.com> * update package-lock Co-authored-by: Robert Sese <734194+rsese@users.noreply.github.com> Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { RepoIcon } from '@primer/octicons-react'
|
|
import { CodeExample } from 'components/context/ProductLandingContext'
|
|
import { TruncateLines } from 'components/ui/TruncateLines'
|
|
import { Label } from '@primer/react'
|
|
|
|
type Props = {
|
|
example: CodeExample
|
|
}
|
|
export const CodeExampleCard = ({ example }: Props) => {
|
|
return (
|
|
<a
|
|
className="Box d-flex flex-column flex-justify-between height-full color-shadow-medium hover-shadow-large no-underline color-fg-default"
|
|
data-testid="code-example-card"
|
|
href={`https://github.com/${example.href}`}
|
|
>
|
|
<div className="p-4">
|
|
<h3 className="f4" dangerouslySetInnerHTML={{ __html: example.title }} />
|
|
<p
|
|
className="mt-2 mb-4 color-fg-muted"
|
|
dangerouslySetInnerHTML={{ __html: example.description }}
|
|
/>
|
|
<div className="d-flex flex-wrap">
|
|
{example.tags.map((tag) => {
|
|
return (
|
|
<Label key={tag} variant="accent" sx={{ mb: 1, mr: 2 }}>
|
|
{tag}
|
|
</Label>
|
|
)
|
|
})}
|
|
</div>
|
|
</div>
|
|
<footer className="border-top p-4 color-fg-muted d-flex flex-items-center">
|
|
<RepoIcon aria-label="repository URL" className="flex-shrink-0" />
|
|
<TruncateLines
|
|
as="span"
|
|
maxLines={1}
|
|
className="ml-2 text-mono text-small color-fg-accent line-break-anywhere"
|
|
>
|
|
{example.href}
|
|
</TruncateLines>
|
|
</footer>
|
|
</a>
|
|
)
|
|
}
|