Skip to content

Commit e8bef41

Browse files
authored
Merge pull request #803 from aws-otel/feature/lambda-application-signals-docs-update
Update Lambda documentation to point to the new ADOT Layers with Application Signals support
2 parents 90e55e4 + d00ecfa commit e8bef41

File tree

19 files changed

+1782
-101
lines changed

19 files changed

+1782
-101
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import React from "react"
2+
import BaseBox from "components/BaseBox/BaseBox.jsx"
3+
4+
class AnnouncementBanner extends BaseBox {
5+
getBackgroundColor() { return '#ff9500'; }
6+
getTextColor() { return 'white'; }
7+
getBorderColor() { return '#e67e00'; }
8+
getIcon() { return '📢'; }
9+
getCodeBlockBg() { return 'rgba(255, 255, 255, 0.2)'; }
10+
getCodeBlockBorder() { return 'rgba(255, 255, 255, 0.5)'; }
11+
getInlineCodeBg() { return 'rgba(255, 255, 255, 0.2)'; }
12+
getButtonStyles() {
13+
return {
14+
backgroundColor: 'rgba(255, 255, 255, 0.2)',
15+
color: 'white',
16+
border: '1px solid rgba(255, 255, 255, 0.3)',
17+
hoverBg: 'rgba(255, 255, 255, 0.3)'
18+
};
19+
}
20+
21+
render() {
22+
// Transform bannerText to textContent for the base class
23+
const transformedProps = {
24+
...this.props,
25+
textContent: this.props.bannerText || this.props.textContent
26+
};
27+
28+
// Temporarily override props for base class render
29+
const originalProps = this.props;
30+
this.props = transformedProps;
31+
const result = super.render();
32+
this.props = originalProps;
33+
34+
return result;
35+
}
36+
}
37+
38+
export default AnnouncementBanner

src/components/BaseBox/BaseBox.jsx

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import React from "react"
2+
3+
class BaseBox extends React.Component {
4+
parseCodeMarkdown(text) {
5+
if (typeof text !== 'string') return text;
6+
7+
// Replace triple backticks (code blocks) first
8+
text = text.replace(/```([^`]+)```/g, (match, code) => {
9+
return `<div style="font-family: monospace; background-color: ${this.getCodeBlockBg()}; padding: 12px; border-radius: 4px; margin: 8px 0; border-left: 4px solid ${this.getCodeBlockBorder()}; overflow-x: auto; white-space: pre;">${code.trim()}</div>`;
10+
});
11+
12+
// Replace single backticks (inline code)
13+
text = text.replace(/`([^`]+)`/g, (match, code) => {
14+
return `<span style="font-family: monospace; background-color: ${this.getInlineCodeBg()}; padding: 2px 4px; border-radius: 3px; font-size: 14px;">${code}</span>`;
15+
});
16+
17+
return text;
18+
}
19+
20+
// Methods to be overridden by child components
21+
getBackgroundColor() { return '#f5f5f5'; }
22+
getTextColor() { return '#424242'; }
23+
getBorderColor() { return '#e0e0e0'; }
24+
getIcon() { return '📋'; }
25+
getCodeBlockBg() { return '#f1f1f1'; }
26+
getCodeBlockBorder() { return '#007acc'; }
27+
getInlineCodeBg() { return '#e8e8e8'; }
28+
getButtonStyles() {
29+
return {
30+
backgroundColor: 'rgba(66, 66, 66, 0.1)',
31+
color: '#424242',
32+
border: '1px solid rgba(66, 66, 66, 0.3)',
33+
hoverBg: 'rgba(66, 66, 66, 0.2)'
34+
};
35+
}
36+
37+
render() {
38+
const { textContent, buttonText, hyperlink, children, scale = 1.0 } = this.props;
39+
const buttonStyles = this.getButtonStyles();
40+
41+
return (
42+
<div style={{
43+
backgroundColor: this.getBackgroundColor(),
44+
color: this.getTextColor(),
45+
padding: `${16 * scale}px ${20 * scale}px`,
46+
marginBottom: `${20 * scale}px`,
47+
borderRadius: `${6 * scale}px`,
48+
border: `1px solid ${this.getBorderColor()}`,
49+
display: 'flex',
50+
alignItems: 'stretch',
51+
gap: `${16 * scale}px`,
52+
minHeight: `${60 * scale}px`,
53+
transform: `scale(${scale})`,
54+
transformOrigin: 'center center',
55+
margin: scale < 1 ? `${20 * scale * (1 - scale)}px auto ${20 * scale}px auto` : `0 auto ${20 * scale}px auto`
56+
}}>
57+
<div style={{
58+
display: 'flex',
59+
alignItems: 'center',
60+
justifyContent: 'center',
61+
flexShrink: 0,
62+
width: `${40 * scale}px`,
63+
fontSize: `clamp(${24 * scale}px, 4vw, ${48 * scale}px)`,
64+
lineHeight: '1'
65+
}}>
66+
{this.getIcon()}
67+
</div>
68+
<div style={{
69+
flex: '1',
70+
display: 'flex',
71+
alignItems: 'center'
72+
}}>
73+
<div style={{
74+
fontWeight: 'normal',
75+
lineHeight: '1.6',
76+
fontFamily: 'inherit',
77+
width: '100%',
78+
fontSize: `${14 * scale}px`,
79+
whiteSpace: 'pre-line'
80+
}} dangerouslySetInnerHTML={{
81+
__html: children ? null : (textContent ? this.parseCodeMarkdown(textContent.replace(/\\n/g, '\n')) : '')
82+
}}>
83+
{children}
84+
</div>
85+
</div>
86+
{buttonText && hyperlink && (
87+
<div style={{
88+
display: 'flex',
89+
alignItems: 'center',
90+
flexShrink: 0
91+
}}>
92+
<a
93+
href={hyperlink}
94+
target="_blank"
95+
rel="noopener noreferrer"
96+
style={{
97+
backgroundColor: buttonStyles.backgroundColor,
98+
color: buttonStyles.color,
99+
textDecoration: 'none',
100+
padding: `${4 * scale}px ${8 * scale}px`,
101+
borderRadius: `${3 * scale}px`,
102+
border: buttonStyles.border,
103+
fontSize: `${12 * scale}px`,
104+
fontWeight: 'normal',
105+
transition: 'background-color 0.2s',
106+
whiteSpace: 'nowrap'
107+
}}
108+
onMouseOver={(e) => e.target.style.backgroundColor = buttonStyles.hoverBg}
109+
onMouseOut={(e) => e.target.style.backgroundColor = buttonStyles.backgroundColor}
110+
>
111+
{buttonText}
112+
</a>
113+
</div>
114+
)}
115+
</div>
116+
);
117+
}
118+
}
119+
120+
export default BaseBox

src/components/InfoBox/InfoBox.jsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from "react"
2+
import BaseBox from "components/BaseBox/BaseBox.jsx"
3+
4+
class InfoBox extends BaseBox {
5+
getBackgroundColor() { return '#f5f5f5'; }
6+
getTextColor() { return '#424242'; }
7+
getBorderColor() { return '#e0e0e0'; }
8+
getIcon() { return '📋'; }
9+
getCodeBlockBg() { return '#f1f1f1'; }
10+
getCodeBlockBorder() { return '#007acc'; }
11+
getInlineCodeBg() { return '#e8e8e8'; }
12+
13+
render() {
14+
// Transform infoText to textContent for the base class
15+
const transformedProps = {
16+
...this.props,
17+
textContent: this.props.infoText || this.props.textContent
18+
};
19+
20+
// Temporarily override props for base class render
21+
const originalProps = this.props;
22+
this.props = transformedProps;
23+
const result = super.render();
24+
this.props = originalProps;
25+
26+
return result;
27+
}
28+
}
29+
30+
export default InfoBox

0 commit comments

Comments
 (0)