-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…t" (#968)
- Loading branch information
Showing
18 changed files
with
549 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/components/Widgets/FeedbackWidget/FeedbackFullScreen.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React, { useContext } from 'react'; | ||
import styled from '@emotion/styled'; | ||
import { HeaderContext } from '../../Header/header-context'; | ||
import useNoScroll from './hooks/useNoScroll'; | ||
import { useFeedbackContext } from './context'; | ||
import ProgressBar from './components/PageIndicators'; | ||
import CloseButton from './components/CloseButton'; | ||
|
||
const FullScreen = styled.div( | ||
(props) => ` | ||
background: white; | ||
height: 100vh; | ||
left: 0; | ||
overflow-y: scroll; | ||
padding-top: ${props.totalHeaderHeight}; | ||
position: fixed; | ||
top: 0; | ||
width: 100vw; | ||
z-index: 1; | ||
` | ||
); | ||
|
||
const Header = styled.div` | ||
padding: 8px; | ||
margin-bottom: 20px; | ||
margin-top: 25px; | ||
position: relative; | ||
display: grid; | ||
grid-template-columns: 7fr 1fr; | ||
justify-content: center; | ||
> span { | ||
padding-left: 116px !important; | ||
} | ||
`; | ||
|
||
const Content = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
min-width: 280px; | ||
margin: 0 auto; | ||
padding: 0 56px; | ||
`; | ||
|
||
const FeedbackFullScreen = ({ isOpen, children }) => { | ||
const { abandon } = useFeedbackContext(); | ||
const { totalHeaderHeight } = useContext(HeaderContext); | ||
useNoScroll(isOpen); | ||
return ( | ||
isOpen && ( | ||
<FullScreen totalHeaderHeight={totalHeaderHeight}> | ||
<Header> | ||
<ProgressBar /> | ||
<CloseButton size="xlarge" onClick={abandon} /> | ||
</Header> | ||
<Content>{children}</Content> | ||
</FullScreen> | ||
) | ||
); | ||
}; | ||
|
||
export default FeedbackFullScreen; |
54 changes: 54 additions & 0 deletions
54
src/components/Widgets/FeedbackWidget/FloatingContainer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import { css } from '@emotion/react'; | ||
import LeafygreenCard from '@leafygreen-ui/card'; | ||
import styled from '@emotion/styled'; | ||
import { feedbackId } from '../FeedbackWidget/FeedbackForm'; | ||
import ProgressBar from './components/PageIndicators'; | ||
import CloseButton from './components/CloseButton'; | ||
import { useFeedbackContext } from './context'; | ||
|
||
const feedbackStyle = css` | ||
z-index: 14; | ||
`; | ||
|
||
export default function FloatingContainer({ isOpen, children }) { | ||
const { abandon } = useFeedbackContext(); | ||
|
||
return ( | ||
isOpen && ( | ||
<Floating id={feedbackId} css={feedbackStyle}> | ||
<Card> | ||
<CardHeader> | ||
<ProgressBar /> | ||
<CloseButton onClick={() => abandon()} /> | ||
</CardHeader> | ||
<Content>{children}</Content> | ||
</Card> | ||
</Floating> | ||
) | ||
); | ||
} | ||
|
||
const Floating = styled.div` | ||
position: fixed; | ||
bottom: 40px; | ||
right: 16px; | ||
z-index: 20; | ||
`; | ||
|
||
const Card = styled(LeafygreenCard)` | ||
/* Card Size */ | ||
width: 234px; | ||
min-height: 320px; | ||
max-height: 320px; | ||
align-items: center; | ||
`; | ||
const CardHeader = styled.div` | ||
display: flex; | ||
justify-content: flex-end; | ||
margin-top: 5px; | ||
margin-right: 10px; | ||
`; | ||
const Content = styled.div` | ||
margin: 0px 24px; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import styled from '@emotion/styled'; | ||
import { theme } from '../../../../theme/docsTheme'; | ||
|
||
const StyledEmoji = styled('span')` | ||
font-size: ${theme.fontSize.h2}; | ||
`; | ||
|
||
const getEmoji = (sentiment) => { | ||
switch (sentiment) { | ||
case 'Positive': | ||
return '🙂'; | ||
case 'Negative': | ||
return '😞'; | ||
case 'Suggestion': | ||
return '💡'; | ||
default: | ||
return '💡'; | ||
} | ||
}; | ||
|
||
const Emoji = ({ sentiment }) => { | ||
const emoji = getEmoji(sentiment); | ||
return <StyledEmoji>{emoji}</StyledEmoji>; | ||
}; | ||
|
||
export default Emoji; |
18 changes: 11 additions & 7 deletions
18
src/components/Widgets/FeedbackWidget/components/PageIndicators.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.