Skip to content

Commit 6dd7410

Browse files
committed
placement changes
1 parent 24dbc68 commit 6dd7410

File tree

3 files changed

+63
-35
lines changed

3 files changed

+63
-35
lines changed
Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,38 @@
1-
.wrapper {
2-
box-sizing: border-box;
3-
min-width: 0;
4-
transition: color var(--t-interaction);
1+
.feedbackForm {
2+
z-index: 10;
3+
position: relative;
4+
padding: 1rem 0;
5+
}
6+
7+
.svgContainer {
8+
display: flex;
9+
flex-direction: column;
10+
align-items: center;
11+
text-align: center;
12+
}
13+
14+
.feedbackTitle {
15+
font-size: 1.25rem; /* Slightly larger font size */
16+
font-weight: bold;
17+
margin-bottom: 0.5rem;
18+
color: var(--color-darkest);
19+
}
520

6-
&.docs {
7-
color: var(--color-note);
21+
.buttonContainer {
22+
display: flex;
23+
justify-content: center;
24+
gap: 1rem;
25+
}
826

9-
&:visited {
10-
color: var(--color-dark-purple);
11-
}
27+
.feedbackButton {
28+
font-size: 1.5rem;
29+
background: none;
30+
border: none;
31+
cursor: pointer;
32+
}
1233

13-
&:hover,
14-
&:active,
15-
&:focus {
16-
color: var(--color-light-purple);
17-
}
18-
}
34+
.feedbackMessage {
35+
margin-top: 1rem;
36+
color: green;
1937
}
38+

src/components/ThumbsFeedback.tsx

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState } from 'react';
2-
import styles from "./ThumbsFeedback.module.css";
2+
import styles from './ThumbsFeedback.module.css';
33

44
// Define gtag on window object for TypeScript
55
declare global {
@@ -10,7 +10,7 @@ declare global {
1010

1111
const ThumbsFeedback = () => {
1212
const [submitted, setSubmitted] = useState(false);
13-
13+
1414
const handleFeedback = (type: 'up' | 'down') => {
1515
if (typeof window !== 'undefined' && typeof window.gtag === 'function') {
1616
window.gtag('event', 'feedback', {
@@ -19,32 +19,39 @@ const ThumbsFeedback = () => {
1919
value: 1,
2020
});
2121
}
22-
22+
2323
setSubmitted(true);
2424
};
25-
25+
2626
if (submitted) {
2727
return <div className={styles.feedbackMessage}>Thanks for the feedback!</div>;
2828
}
29-
29+
3030
return (
31-
<div className={styles.feedbackContainer}>
32-
<button
33-
onClick={() => handleFeedback('up')}
34-
aria-label="Thumbs up"
35-
className={styles.feedbackButton}
36-
>
37-
👍
38-
</button>
39-
<button
40-
onClick={() => handleFeedback('down')}
41-
aria-label="Thumbs down"
42-
className={styles.feedbackButton}
43-
>
44-
👎
45-
</button>
31+
<div className={styles.feedbackForm}>
32+
<div className={styles.svgContainer}>
33+
<p className={styles.feedbackTitle}>Was this page helpful?</p>
34+
<div className={styles.buttonContainer}>
35+
<button
36+
onClick={() => handleFeedback('up')}
37+
aria-label="Thumbs up"
38+
className={styles.feedbackButton}
39+
>
40+
👍
41+
</button>
42+
<span className={styles.buttonSeparator}></span>
43+
<button
44+
onClick={() => handleFeedback('down')}
45+
aria-label="Thumbs down"
46+
className={styles.feedbackButton}
47+
>
48+
👎
49+
</button>
50+
</div>
51+
</div>
4652
</div>
4753
);
4854
};
4955

5056
export default ThumbsFeedback;
57+

src/theme/DocItem/Layout/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import DocBreadcrumbs from "@theme/DocBreadcrumbs";
1313
import Unlisted from "@theme/ContentVisibility/Unlisted";
1414
import NavbarMobileSidebarToggle from "@theme/Navbar/MobileSidebar/Toggle";
1515
import type { Props } from "@theme/DocItem/Layout";
16+
import ThumbsFeedback from '@site/src/components/ThumbsFeedback';
1617

1718
import styles from "./styles.module.css";
1819

@@ -65,6 +66,7 @@ export default function DocItemLayout({ children }: Props): JSX.Element {
6566
</div>
6667
</div>
6768
{docTOC.desktop && <div className="col col--3">{docTOC.desktop}</div>}
69+
<ThumbsFeedback />
6870
</div>
6971
);
7072
}

0 commit comments

Comments
 (0)