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

feat: Feedback dialog #772

Merged
merged 31 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f4b4f6e
feat: initial commit and experience selector
vpicone Mar 9, 2020
3e7cba1
feat: add data submission
vpicone Mar 9, 2020
fa0a846
feat: add text fadeout
vpicone Mar 9, 2020
2078af4
fix: thicken outline when focused
vpicone Mar 9, 2020
b85ef59
feat: better focus handling
vpicone Mar 9, 2020
02b63c0
fix: focus stealing
vpicone Mar 9, 2020
6ab141c
fix: button text alignment, fieldset spacing, pointer events
vpicone Mar 10, 2020
47df804
fix: focus and style tweaks, use Carbon textbox
vpicone Mar 10, 2020
4371453
feat: add entrance animation
vpicone Mar 11, 2020
62002f2
feat: fade on scroll
vpicone Mar 11, 2020
6efec09
Merge branch 'master' into feedback-dialog
vpicone Mar 11, 2020
34aa206
fix: animation choreography
vpicone Mar 11, 2020
2ba30be
Merge branch 'feedback-dialog' of github.com:vpicone/gatsby-theme-car…
vpicone Mar 11, 2020
68458ef
feat: add livve url
vpicone Mar 12, 2020
950c3ac
fix: safari zamboni and text zoom
vpicone Mar 12, 2020
b86ac5e
fix: safari zamboni and resize
vpicone Mar 12, 2020
7858fe7
fix: animation performance
vpicone Mar 12, 2020
c712134
docs: add Feedback docs
vpicone Mar 12, 2020
230deb5
fix: homepage rendering and console errors
vpicone Mar 12, 2020
10e523a
fix: desktop transition speed
vpicone Mar 12, 2020
e8de24a
fix: focus return and icon flexibility
vpicone Mar 13, 2020
ecdaa7d
cchore: remove unused dep
vpicone Mar 13, 2020
19d0c2a
fix: list overflow weirdness
vpicone Mar 14, 2020
6273273
feat: add submission indicators and mobile styles
vpicone Mar 14, 2020
a408fd7
chore: checkmark tweaks
vpicone Mar 14, 2020
fe18144
fix: launch button active and hover styles
vpicone Mar 14, 2020
44a2c5c
fix: use proper focus token
vpicone Mar 14, 2020
a8f11ab
fix: icon visibility animation
vpicone Mar 14, 2020
d2b7602
fix: slow down stroke, add thanks and adjust reset
vpicone Mar 16, 2020
6c9f847
fix: add background hover change
vpicone Mar 16, 2020
0819436
fix: inverse 01
vpicone Mar 16, 2020
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
Prev Previous commit
Next Next commit
fix: safari zamboni and text zoom
  • Loading branch information
vpicone committed Mar 12, 2020
commit 950c3ac96a71c4c8b7751e84cc7112faa77b7bca
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
/* eslint-disable jsx-a11y/label-has-associated-control */
// eslint doesn't know about TextArea labeling
import React from 'react';
import React, { useState } from 'react';
import { TextArea } from 'carbon-components-react';
import cx from 'classnames';
import styles from './Comment.module.scss';

const Comment = () => {
const [focused, setFocused] = useState(false);
const handleBlur = e => {
e.target.scrollTop = 0;
setFocused(false);
};

return (
<div className={styles.container}>
<TextArea
className={styles.textarea}
labelText="Comments (optional):"
onBlur={handleBlur}
onFocus={() => setFocused(true)}
rows={5}
name="feedback-form-comment"
id="feedback-form-comment"
/>
<div className={styles.fadeout} />
<div
className={cx(styles.fadeout, {
[styles.focused]: focused,
})}
/>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
position: relative;
}

.textarea {
@include carbon--type-style('body-short-02');
@include carbon--breakpoint('md') {
@include carbon--type-style('body-short-01');
}
}

.fadeout {
// safari hate's zambonis
display: none;
pointer-events: none;
position: absolute;
bottom: $spacing-03;
Expand All @@ -11,8 +20,11 @@
width: calc(100% - 1rem);
background: linear-gradient(transparent, var(--cds-ui-01));
height: 3rem;
@include carbon--breakpoint('lg') {
display: block;
}
}

.container:focus-within .fadeout {
.focused {
opacity: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ const Form = ({ visible, setVisible, launchButtonRef }) => {
path: window.location.href,
};

fetch('https://carbon-website.netlify.com/.netlify/functions/survey', {
method: 'POST',
mode: 'no-cors',
credentials: 'include',
body: JSON.stringify(data),
});
// fetch('https://carbon-website.netlify.com/.netlify/functions/survey', {
// method: 'POST',
// mode: 'no-cors',
// credentials: 'include',
// body: JSON.stringify(data),
// });
console.log(data);

setVisible(false);
};
Expand Down
27 changes: 25 additions & 2 deletions packages/gatsby-theme-carbon/src/util/hooks/useOnClickOutside.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import { useEffect } from 'react';

let passiveListenerSupported;

try {
const opts = Object.defineProperty({}, 'passive', {
// eslint-disable-next-line getter-return
get() {
passiveListenerSupported = true;
},
});
window.addEventListener('testPassive', null, opts);
window.removeEventListener('testPassive', null, opts);
} catch (e) {
passiveListenerSupported = false;
}

function useOnClickOutside(ref, handler) {
useEffect(() => {
const listener = event => {
Expand All @@ -9,8 +24,16 @@ function useOnClickOutside(ref, handler) {
handler(event);
};

document.addEventListener('mousedown', listener);
document.addEventListener('touchstart', listener);
document.addEventListener(
'mousedown',
listener,
passiveListenerSupported ? { passive: true } : false
);
document.addEventListener(
'touchstart',
listener,
passiveListenerSupported ? { passive: true } : false
);

return () => {
document.removeEventListener('mousedown', listener);
Expand Down