Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/connect-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<!-- markdownlint-disable MD024 -->
# Changelog

# [1.0.0-preview.27] - 2025-01-30

- Add styling to alerts

# [1.0.0-preview.26] - 2025-01-29

- No change

# [1.0.0-preview.25] - 2025-01-28

- Show prop labels instead of values after selecting dynamic props
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-react/examples/nextjs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/connect-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/connect-react",
"version": "1.0.0-preview.26",
"version": "1.0.0-preview.27",
"description": "Pipedream Connect library for React",
"files": [
"dist"
Expand Down
59 changes: 57 additions & 2 deletions packages/connect-react/src/components/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,65 @@
import type { ConfigurablePropAlert } from "@pipedream/sdk";
import Markdown from "react-markdown";

type AlertProps = {
prop: ConfigurablePropAlert;
};

export function Alert({ prop }: AlertProps) {
// XXX useCustomize, getClassNames
return <p className={`pd-alert-${prop.alertType}`}>{prop.content}</p>;
const baseStyles = {
background: "#e2e3e5",
borderRadius: "10px",
paddingTop: "2px",
paddingLeft: "10px",
paddingRight: "10px",
paddingBottom: "2px",
}

const warningStyles = {
...baseStyles,
background: "#fff3cd",
};

const infoStyles = {
...baseStyles,
background: "#d1ecf1",
}

const errorStyles = {
...baseStyles,
background: "#f8d7da",
}

const neutralStyles = {
...baseStyles,
background: "#fffff2",
}

let alertStyles = {}
switch (prop.alertType) {
case "info":
alertStyles = infoStyles
break
case "neutral":
alertStyles = neutralStyles
break
case "warning":
alertStyles = warningStyles
break
case "error":
alertStyles = errorStyles
break
default:
alertStyles = baseStyles
}

return (<div className={`pd-alert-${prop.alertType}`} style={alertStyles}>
<Markdown components={{
a: ({ ...props }) => {
return <a {...props} target="_blank" rel="noopener noreferrer" />;
},
}}>
{prop.content}
</Markdown>
</div>)
}
8 changes: 7 additions & 1 deletion packages/connect-react/src/components/Description.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CSSProperties } from "react";
import Markdown from "react-markdown";
import { ConfigurableProp, ConfigurableProps } from "@pipedream/sdk";

Check failure on line 3 in packages/connect-react/src/components/Description.tsx

View workflow job for this annotation

GitHub Actions / Lint Code Base

Expected a line break after this opening brace

Check failure on line 3 in packages/connect-react/src/components/Description.tsx

View workflow job for this annotation

GitHub Actions / Lint Code Base

Expected a line break before this closing brace
import { useCustomize } from "../hooks/customization-context";
import { FormFieldContext } from "../hooks/form-field-context";
import { FormContext } from "../hooks/form-context";
Expand Down Expand Up @@ -41,5 +41,11 @@
if (!prop.description) {
return null;
}
return <div className={getClassNames("description", props)} style={getStyles("description", baseStyles, props)}><Markdown>{markdown}</Markdown></div>;
return <div className={getClassNames("description", props)} style={getStyles("description", baseStyles, props)}> <Markdown components={{
a: ({ ...props }) => {
return <a {...props} target="_blank" rel="noopener noreferrer" />;
},
}}>
{markdown}
</Markdown></div>;
}
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading