Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding more usecases to lifecycle component #4804

Merged
merged 12 commits into from
Feb 10, 2024
1 change: 0 additions & 1 deletion website/docs/docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pagination_next: null
pagination_prev: null
---


<Snippet path="what-is-dbt-intro" />

dbt compiles and runs your analytics code against your data platform, enabling you and your team to collaborate on a single source of truth for metrics, insights, and business definitions. This single source of truth, combined with the ability to define tests for your data, reduces errors when logic changes, and alerts you when issues arise.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/docs/use-dbt-semantic-layer/dbt-sl.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import DeprecationNotice from '/snippets/_sl-deprecation-notice.md';

<DeprecationNotice />

</VersionBlock>
</VersionBlock>

The dbt Semantic Layer, powered by [MetricFlow](/docs/build/about-metricflow), simplifies the process of defining and using critical business metrics, like `revenue` in the modeling layer (your dbt project). By centralizing metric definitions, data teams can ensure consistent self-service access to these metrics in downstream data tools and applications. The dbt Semantic Layer eliminates duplicate coding by allowing data teams to define metrics on top of existing models and automatically handles data joins.

Expand Down
45 changes: 39 additions & 6 deletions website/src/components/lifeCycle/index.js
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,11 +1,44 @@
import React from 'react'
import styles from './styles.module.css';

const statusColors = {
enterprise: '#EBEDF0',
team: '#EBEDF0',
developer: '#EBEDF0',
new: '#047377',
beta: '#047377',
ga: '#047377',
'public preview': '#047377',
};

const fontColors = {
enterprise: '#262A38',
team: '#262A38',
developer: '#262A38',
// lifecycle statuses use the css determined font color (white)
};

export default function Lifecycle(props) {
if (!props.status) {
return null;
}
return (
<span className={styles.lifecycle}>{props.status}</span>
);
if (!props.status || (Array.isArray(props.status) && props.status.length === 0)) {
return null;
}
Comment on lines +22 to +24
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

// Check if props.status is an array or a single value
const statuses = Array.isArray(props.status) ? props.status : [props.status];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great way to ensure statuses is always an array!

Also wanted to share a shorthand way of achieving the same result using the spread operator:
const statuses = [...props.status];

If props.status is a string, it will spread it into an array. If props.status is an array, it will create a clone of it, essentially being the same as the initial array.


return (
<>
{statuses.map((status, index) => {
const style = {
backgroundColor: props.backgroundColor || statusColors[status] || '#047377', // default to teal if no match
color: fontColors[status] || '#fff' // default font color if no matc
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
};

return (
<span key={index} className={`${styles.lifecycle} lifecycle-badge`} style={style}>
{status}
</span>
);
})}
</>
);
}
10 changes: 6 additions & 4 deletions website/src/components/lifeCycle/styles.module.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
.lifecycle {
background-color: #047377; /* Teal background to align with dbt Labs' color */
color: #fff; /* Light text color for contrast */
font-size: 0.78rem; /* Using rem so font size is relative to root */
background-color: #047377; /* Default teal background */
color: #262A38; /* Light text color for contrast */
font-size: 0.8rem; /* Using rem so font size is relative to root */
font-weight: 600; /* Normal font weight */
padding: 1px 8px; /* Adjust padding for a more pill-like shape */
border-radius: 16px; /* Larger border-radius for rounded edges */
margin-left: 8px; /* Margin to separate from the header text */
vertical-align: middle; /* Align with the title */
display: inline-block; /* Use inline-block for better control */
font-weight: bold; /* Bold text */
text-transform: capitalize; /* Uppercase text */
line-height: 1.6; /* Adjust line height for vertical alignment */
}


4 changes: 4 additions & 0 deletions website/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -2086,6 +2086,10 @@ h2.anchor.clicked a.hash-link:before {
color: #fff; /* Change color on hover if desired */
}

.table-of-contents .lifecycle-badge {
display: none;
}

@media (max-width: 996px) {
.quickstart-container {
flex-direction: column;
Expand Down
1 change: 1 addition & 0 deletions website/src/theme/DocItem/Layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function useDocTOC() {
async function fetchElements() {
// get html elements
const headings = await getElements(".markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6")


// if headings exist on page
// compare against toc
Expand Down
Loading