Skip to content

Commit

Permalink
Merge branch 'current' into mwong-sl-st
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 authored Dec 4, 2023
2 parents 74dc0c4 + 75ba438 commit af5e460
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dbt Core v1.6 has three significant areas of focus:
## Resources

- [Changelog](https://github.com/dbt-labs/dbt-core/blob/1.6.latest/CHANGELOG.md)
- [CLI Installation guide](/docs/core/installation-overview
- [dbt Core installation guide](/docs/core/installation-overview)
- [Cloud upgrade guide](/docs/dbt-versions/upgrade-core-in-cloud)
- [Release schedule](https://github.com/dbt-labs/dbt-core/issues/7481)

Expand Down
2 changes: 1 addition & 1 deletion website/docs/faqs/Tests/testing-sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ id: testing-sources
To run tests on all sources, use the following command:

```shell
$ dbt test --select source:*
dbt test --select "source:*"
```

(You can also use the `-s` shorthand here instead of `--select`)
Expand Down
116 changes: 88 additions & 28 deletions website/src/components/communitySpotlightCard/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import Link from '@docusaurus/Link';
import Head from "@docusaurus/Head";
import styles from './styles.module.css';
import imageCacheWrapper from '../../../functions/image-cache-wrapper';

Expand Down Expand Up @@ -47,44 +48,72 @@ function CommunitySpotlightCard({ frontMatter, isSpotlightMember = false }) {
jobTitle,
companyName,
organization,
socialLinks
socialLinks,
communityAward
} = frontMatter

return (
<SpotlightWrapper isSpotlightMember={isSpotlightMember} frontMatter={frontMatter}>
// Get meta description text
const metaDescription = stripHtml(description)

return (
<SpotlightWrapper
isSpotlightMember={isSpotlightMember}
frontMatter={frontMatter}
>
{isSpotlightMember && metaDescription ? (
<Head>
<meta
name="description"
content={metaDescription}
/>
<meta
property="og:description"
content={metaDescription}
/>
</Head>
) : null}
{communityAward ? (
<div className={styles.awardBadge}>
<span>Community Award Recipient</span>
</div>
) : null}
{image && (
<div className={styles.spotlightMemberImgContainer}>
{id && isSpotlightMember ? (
<img
src={imageCacheWrapper(image)}
alt={title}
/>
<img src={imageCacheWrapper(image)} alt={title} />
) : (
<Link to={`/community/spotlight/${id}`} className={styles.spotlightMemberHeader}>
<img
src={imageCacheWrapper(image)}
alt={title}
/>
<Link
to={`/community/spotlight/${id}`}
className={styles.spotlightMemberHeader}
>
<img src={imageCacheWrapper(image)} alt={title} />
</Link>
)}
</div>
)}
<div className={styles.spotlightMemberContent}>
{!isSpotlightMember && id ? (
<h2>
<Link to={`/community/spotlight/${id}`} className={`${styles.spotlightMemberHeader} ${styles.spotlightMemberHeaderSmall}`}>{title}</Link>
<Link
to={`/community/spotlight/${id}`}
className={`${styles.spotlightMemberHeader} ${styles.spotlightMemberHeaderSmall}`}
>
{title}
</Link>
</h2>
) : (
) : (
<h1 className={styles.spotlightMemberHeader}>{title}</h1>
)}
{pronouns && <div className={styles.spotlightMemberPronouns}>{pronouns}</div>}

{pronouns && (
<div className={styles.spotlightMemberPronouns}>{pronouns}</div>
)}

{isSpotlightMember && (
<div className={styles.spotlightMemberHeaderContain}>
{(jobTitle || companyName) && (
<div className={styles.spotlightMemberInfo}>
{jobTitle && jobTitle}
{jobTitle && companyName && ', '}
{jobTitle && companyName && ", "}
{companyName && companyName}
</div>
)}
Expand All @@ -101,46 +130,60 @@ function CommunitySpotlightCard({ frontMatter, isSpotlightMember = false }) {
</div>
)}
{description && !isSpotlightMember && (
<p className={styles.spotlightMemberDescription} dangerouslySetInnerHTML={{__html: truncateText(description)}} />
<p
className={styles.spotlightMemberDescription}
dangerouslySetInnerHTML={{ __html: truncateText(description) }}
/>
)}
{socialLinks && isSpotlightMember && socialLinks?.length > 0 && (
<div className={styles.spotlightMemberSocial}>
{socialLinks.map((item, i) => (
<>
{item?.name && item?.link && (
<>
{i !== 0 && ' | '}
<a href={item.link} title={item.name} target='_blank' rel='noreferrer'>{item.name}</a>
{i !== 0 && " | "}
<a
href={item.link}
title={item.name}
target="_blank"
rel="noreferrer"
>
{item.name}
</a>
</>
)}
</>
))}
</div>
)}
{id && !isSpotlightMember && (
<Link
to={`/community/spotlight/${id}`}
<Link
to={`/community/spotlight/${id}`}
className={styles.spotlightReadMore}
>Read More</Link>
>
Read More
</Link>
)}
</div>
{description && isSpotlightMember && (
<div className={styles.spotlightMemberDescriptionFull}>
<h2>About</h2>
<p className={styles.spotlightMemberDescription} dangerouslySetInnerHTML={{__html: description}} />

<p
className={styles.spotlightMemberDescription}
dangerouslySetInnerHTML={{ __html: description }}
/>
</div>
)}
</SpotlightWrapper>
)
);
}

// Truncate text
// Truncate description text for community member cards
function truncateText(str) {
// Max length of string
let maxLength = 300

// Check if anchor link starts within first 300 characters
// Check if anchor link starts within maxLength
let hasLinks = false
if(str.substring(0, maxLength - 3).match(/(?:<a)/g)) {
hasLinks = true
Expand All @@ -162,4 +205,21 @@ function truncateText(str) {
: str
}

// Strip HTML for meta description
function stripHtml(desc) {
const maxLength = 130

if(!desc) return null

// Remove HTML elements from string
const strippedHtml = desc?.replace(/(<([^>]+)>)/gi, "")

// Strip new lines and return 130 character substring for description
const updatedDesc = strippedHtml
?.substring(0, maxLength)
?.replace(/(\r\n|\r|\n)/g, "");

return desc?.length > maxLength ? `${updatedDesc}...` : updatedDesc
}

export default CommunitySpotlightCard
20 changes: 16 additions & 4 deletions website/src/components/communitySpotlightCard/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ header.spotlightMemberCard {
div.spotlightMemberCard {
margin-bottom: 2.5rem;
}
.spotlightMemberCard .awardBadge {
flex: 0 0 100%;
margin-bottom: .5rem;
}
.spotlightMemberCard .awardBadge span {
max-width: fit-content;
color: #fff;
background: var(--ifm-color-primary);
display: block;
border-radius: 1rem;
padding: 5px 10px;
font-size: .7rem;
}
.spotlightMemberCard .spotlightMemberImgContainer {
flex: 0 0 100%;
}
Expand Down Expand Up @@ -81,6 +94,9 @@ div.spotlightMemberCard {
margin-bottom: 0;
padding-left: 0;
}
.spotlightMemberCard .awardBadge span {
font-size: .8rem;
}
.spotlightMemberCard .spotlightMemberImgContainer {
flex: 0 0 346px;
margin-right: 2rem;
Expand All @@ -100,7 +116,3 @@ div.spotlightMemberCard {
line-height: 2rem;
}
}




1 change: 1 addition & 0 deletions website/src/components/communitySpotlightList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function CommunitySpotlightList({ spotlightData }) {
<Head>
<title>{metaTitle}</title>
<meta property="og:title" content={metaTitle} />
<meta property="description" content={communityDescription} />
<meta property="og:description" content={communityDescription} />
</Head>
<Hero
Expand Down

0 comments on commit af5e460

Please sign in to comment.