-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fuselage): Message Template (#458)
- Loading branch information
Showing
52 changed files
with
1,217 additions
and
102 deletions.
There are no files selected for viewing
Binary file modified
BIN
-82 Bytes
(96%)
packages/fuselage/.loki/reference/chrome_iphone7_Data_Display_Chip_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-248 Bytes
(90%)
packages/fuselage/.loki/reference/chrome_iphone7_Data_Display_Chip_Dismissible.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-296 Bytes
(97%)
packages/fuselage/.loki/reference/chrome_iphone7_Data_Display_Chip_Example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-73 Bytes
(98%)
packages/fuselage/.loki/reference/chrome_iphone7_Data_Display_Chip_With_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-144 Bytes
(93%)
packages/fuselage/.loki/reference/chrome_iphone7_Data_Display_Tag_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.4 KB
packages/fuselage/.loki/reference/chrome_iphone7_Message_Toolbox_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.73 KB
packages/fuselage/.loki/reference/chrome_iphone7_Messages_Divider_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+184 KB
packages/fuselage/.loki/reference/chrome_iphone7_Messages_Message_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.4 KB
...es/fuselage/.loki/reference/chrome_iphone7_Messages_Message_Toolbox_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.4 KB
packages/fuselage/.loki/reference/chrome_iphone7_Messages_Toolbox_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-10.1 KB
(95%)
packages/fuselage/.loki/reference/chrome_laptop_Buttons_Button_States.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-64 Bytes
(93%)
packages/fuselage/.loki/reference/chrome_laptop_Data_Display_Chip_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-131 Bytes
(88%)
packages/fuselage/.loki/reference/chrome_laptop_Data_Display_Chip_Dismissible.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-104 Bytes
(97%)
packages/fuselage/.loki/reference/chrome_laptop_Data_Display_Chip_Example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-21 Bytes
(99%)
packages/fuselage/.loki/reference/chrome_laptop_Data_Display_Chip_With_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-41 Bytes
(95%)
packages/fuselage/.loki/reference/chrome_laptop_Data_Display_Tag_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.29 KB
packages/fuselage/.loki/reference/chrome_laptop_Message_Toolbox_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.07 KB
packages/fuselage/.loki/reference/chrome_laptop_Messages_Divider_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+74.9 KB
packages/fuselage/.loki/reference/chrome_laptop_Messages_Message_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.29 KB
...ges/fuselage/.loki/reference/chrome_laptop_Messages_Message_Toolbox_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.29 KB
packages/fuselage/.loki/reference/chrome_laptop_Messages_Toolbox_Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
../../../Rocket.Chat.Fuselage/packages/fuselage |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./dist/fuselage.production.js'); | ||
} else { | ||
module.exports = require('./dist/fuselage.development.js'); | ||
} | ||
module.exports = require('./dist/fuselage.development.js'); | ||
// if (process.env.NODE_ENV === 'production') { | ||
// module.exports = require('./dist/fuselage.production.js'); | ||
// } else { | ||
// } |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,10 @@ | ||
import React, { ComponentProps, FC } from 'react'; | ||
|
||
import { Box } from '../Box'; | ||
|
||
type DividerProps = ComponentProps<typeof Box>; | ||
|
||
const Divider: FC<DividerProps> = (props) => ( | ||
<Box is='hr' rcx-divider {...props} /> | ||
); | ||
export { Divider }; |
20 changes: 20 additions & 0 deletions
20
packages/fuselage/src/components/Message/Divider/Divider.stories.mdx
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,20 @@ | ||
import { Meta, Canvas, ArgsTable, Story } from '@storybook/addon-docs/blocks'; | ||
|
||
import { Divider } from '.'; | ||
import { Box } from '../..'; | ||
|
||
<Meta title='Messages/Divider' parameters={{ jest: ['Divider/spec'] }} /> | ||
|
||
# Divider | ||
|
||
<Canvas> | ||
<Story name='Default'> | ||
<Box> | ||
<Divider>Text</Divider> | ||
<Divider unreadLabel={'Unread'}>Text</Divider> | ||
<Divider unreadLabel={'Unread'} /> | ||
</Box> | ||
</Story> | ||
</Canvas> | ||
|
||
<ArgsTable of={Divider} /> |
30 changes: 30 additions & 0 deletions
30
packages/fuselage/src/components/Message/Divider/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,30 @@ | ||
import React, { FC } from 'react'; | ||
|
||
const Divider: FC<{ | ||
unreadLabel?: string; | ||
}> = ({ children, unreadLabel, ...props }) => ( | ||
<div | ||
role='separator' | ||
className={ | ||
!unreadLabel | ||
? 'rcx-message-divider' | ||
: 'rcx-message-divider rcx-message-divider--unread' | ||
} | ||
{...props} | ||
> | ||
{children && ( | ||
<> | ||
<div className='rcx-message-divider__bar' /> | ||
<div className='rcx-message-divider__wrapper'>{children}</div>{' '} | ||
</> | ||
)} | ||
<div className='rcx-message-divider__bar'> | ||
{unreadLabel && ( | ||
<div className='rcx-message-divider__wrapper--unread'> | ||
{unreadLabel} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
export { Divider }; |
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,10 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
import { Divider } from '../..'; | ||
|
||
it('renders without crashing', () => { | ||
const div = document.createElement('div'); | ||
ReactDOM.render(<Divider />, div); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); |
95 changes: 95 additions & 0 deletions
95
packages/fuselage/src/components/Message/Divider/styles.scss
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,95 @@ | ||
@use '../../../styles/colors.scss'; | ||
@use '../../../styles/lengths.scss'; | ||
@use '../../../styles/typography.scss'; | ||
|
||
$message-background-color: theme( | ||
'message-background-color', | ||
colors.foreground(alternative) | ||
); | ||
|
||
$message-divider-background-color: theme( | ||
'message-divider-background-color', | ||
colors.neutral(300) | ||
); | ||
$message-divider-color: theme( | ||
'message-divider-color', | ||
colors.foreground(default) | ||
); | ||
|
||
$message-divider-color-unread: theme( | ||
'message-divider-color-unread', | ||
colors.danger(500) | ||
); | ||
$message-divider-background-color-unread: theme( | ||
'message-divider-background-color-unread', | ||
colors.danger(300) | ||
); | ||
|
||
$message-divider-size: theme('message-divider-size', lengths.border-width(1)); | ||
|
||
$message-divider-size-neg: theme( | ||
'message-divider-size-neg', | ||
lengths.margin(-1) | ||
); | ||
|
||
.rcx-message-divider { | ||
@include typography.use-font-scale(c1); | ||
position: relative; | ||
z-index: 1; | ||
|
||
display: flex; | ||
align-items: center; | ||
|
||
margin-bottom: $message-divider-size-neg; | ||
margin-inline: lengths.margin(20); | ||
|
||
color: $message-divider-color; | ||
|
||
&__bar { | ||
display: flex; | ||
justify-content: flex-end; | ||
align-items: center; | ||
flex-grow: 1; | ||
|
||
&::after { | ||
flex-grow: 1; | ||
|
||
height: $message-divider-size; | ||
|
||
content: ''; | ||
|
||
background: $message-divider-background-color; | ||
} | ||
} | ||
|
||
&--unread &__bar { | ||
&::after { | ||
background: $message-divider-background-color-unread; | ||
} | ||
} | ||
|
||
// &--unread { | ||
// &:after, | ||
// &:before { | ||
// } | ||
// } | ||
|
||
&__wrapper { | ||
margin-block: lengths.margin(8); | ||
padding-inline: lengths.padding(8); | ||
|
||
background-color: $message-background-color; | ||
|
||
&--unread { | ||
position: fixed; | ||
z-index: 1; | ||
|
||
order: 1; | ||
|
||
padding-inline-start: lengths.padding(8); | ||
|
||
color: $message-divider-color-unread; | ||
background-color: $message-background-color; | ||
} | ||
} | ||
} |
Oops, something went wrong.