This repository has been archived by the owner on Apr 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(reshaping-container): fixes children to move with container
- Loading branch information
Showing
10 changed files
with
186 additions
and
140 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
46 changes: 0 additions & 46 deletions
46
packages/core/src/motions/ReshapingContainer/__docz__/docs.mdx
This file was deleted.
Oops, something went wrong.
Binary file added
BIN
+29.2 KB
...rc/motions/RevealReshapingContainer/__docz__/NotificationPill/images/avatar.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions
32
packages/core/src/motions/RevealReshapingContainer/__docz__/NotificationPill/index.tsx
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,32 @@ | ||
import * as React from 'react'; | ||
import * as Common from '@element-motion/dev'; | ||
import * as Styled from './styled'; | ||
import ReshapingContainer from '../../../RevealReshapingContainer'; | ||
|
||
const avatar = require('./images/avatar.jpg'); | ||
|
||
const NotificationPill = () => ( | ||
<Styled.AlignCenter> | ||
<Common.Toggler interval onIntervalSet={val => val + 1}> | ||
{toggler => ( | ||
<ReshapingContainer | ||
triggerKey={toggler.shown} | ||
display="inline-block" | ||
boxShadow="rgba(32, 33, 36, 0.25) 0px 3px 6px" | ||
padding="4px 6px" | ||
borderRadius="20px" | ||
maxWidth="250px" | ||
> | ||
{motion => ( | ||
<Styled.MessageNotification {...motion} onClick={() => toggler.set(toggler.shown + 1)}> | ||
<Styled.Avatar src={avatar} /> | ||
<Styled.NotificationText>{Styled.messages(toggler.shown)}</Styled.NotificationText> | ||
</Styled.MessageNotification> | ||
)} | ||
</ReshapingContainer> | ||
)} | ||
</Common.Toggler> | ||
</Styled.AlignCenter> | ||
); | ||
|
||
export default NotificationPill; |
46 changes: 46 additions & 0 deletions
46
packages/core/src/motions/RevealReshapingContainer/__docz__/NotificationPill/styled.tsx
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,46 @@ | ||
import styled from 'styled-components'; | ||
|
||
const avatarSize = '18px'; | ||
|
||
export const MessageNotification = styled.div` | ||
display: flex; | ||
align-items: center; | ||
font-size: 14px; | ||
font-weight: 600; | ||
width: 100%; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
cursor: pointer; | ||
`; | ||
|
||
export const AlignCenter = styled.div` | ||
text-align: center; | ||
`; | ||
|
||
export const NotificationText = styled.span` | ||
width: calc(100% - ${avatarSize}); | ||
padding-right: 12px; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
`; | ||
|
||
export const Avatar = styled.img` | ||
border-radius: 50%; | ||
height: ${avatarSize}; | ||
width: ${avatarSize}; | ||
flex-shrink: 0; | ||
margin-right: 6px; | ||
object-fit: cover; | ||
background-color: #ccc; | ||
`; | ||
|
||
export const messages = (index: number = 0) => { | ||
const msgs = [ | ||
'seriously help me i cant get past genchrio', | ||
'sekiro is so hard meh', | ||
'hello???', | ||
'how do i cheese it????', | ||
]; | ||
return msgs[index % msgs.length]; | ||
}; |
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
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.