-
Notifications
You must be signed in to change notification settings - Fork 10
refactor(chat)!: rework styling internals for messages #2188
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,47 +2,44 @@ | |
| @use 'styles/utilities' as *; | ||
|
|
||
| :host { | ||
| --igc-chat-message-padding: #{rem(12px) rem(16px)}; | ||
| --igc-chat-sent-message-start-margin: auto; | ||
| --igc-chat-sent-message-end-margin: unset; | ||
| --igc-chat-message-container-end-margin: auto; | ||
| --ig-chat-message-padding-block: #{pad-block(12px)}; | ||
| --ig-chat-message-padding-inline: #{pad-inline(16px)}; | ||
| --ig-chat-message-padding: var(--ig-chat-message-padding-block) | ||
| var(--ig-chat-message-padding-inline); | ||
| --ig-chat-sent-message-start-margin: auto; | ||
| --ig-chat-sent-message-end-margin: unset; | ||
| --ig-chat-message-container-end-margin: auto; | ||
|
Comment on lines
+5
to
+11
|
||
|
|
||
| display: flex; | ||
| flex-direction: column; | ||
| width: 100%; | ||
| } | ||
|
|
||
| [part~='message-container'], | ||
| [part='plain-text'] { | ||
| @include type-style('body-1') { | ||
| margin: 0; | ||
| }; | ||
| } | ||
|
|
||
| [part~='message-container'] { | ||
| display: flex; | ||
| margin-inline-end: var(--igc-chat-message-container-end-margin); | ||
| margin-inline-end: var(--ig-chat-message-container-end-margin); | ||
| flex-direction: column; | ||
| padding: var(--ig-chat-message-padding); | ||
| gap: rem(16px); | ||
|
|
||
| p { | ||
| margin: 0; | ||
| padding: 0; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
|
||
| a { | ||
| overflow-wrap: anywhere; | ||
| color: color(primary, 500); | ||
| overflow-wrap: anywhere; | ||
| color: color(primary, 500); | ||
| } | ||
|
|
||
| pre.shiki { | ||
| font-size: rem(14px); | ||
| line-height: rem(24px); | ||
| padding: rem(16px); | ||
| border-radius: rem(4px); | ||
| max-height: rem(320px); | ||
| max-width: rem(680px); | ||
| overflow-y: auto; | ||
| font-size: rem(14px); | ||
| line-height: rem(24px); | ||
| padding: rem(16px); | ||
| border-radius: rem(4px); | ||
| max-height: rem(320px); | ||
| max-width: rem(680px); | ||
| overflow-y: auto; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -51,14 +48,13 @@ | |
| [part~='message-actions'], | ||
| [part~='plain-text'] { | ||
| &:empty { | ||
| display: none; | ||
| display: none; | ||
| } | ||
| } | ||
|
|
||
| [part~='sent'] { | ||
| margin-inline: var(--igc-chat-sent-message-start-margin, 0) var(--igc-chat-sent-message-end-margin, 0); | ||
| padding: var(--igc-chat-message-padding); | ||
| border-radius: rem(24px) rem(24px) 0; | ||
| margin-inline: var(--ig-chat-sent-message-start-margin, 0) | ||
| var(--ig-chat-sent-message-end-margin, 0); | ||
| max-width: rem(576px); | ||
| width: fit-content; | ||
| } | ||
|
Comment on lines
55
to
60
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,18 @@ | ||
| import { css } from 'lit'; | ||
|
|
||
| import type { Themes } from '../../../theming/types.js'; | ||
| // Shared Styles | ||
| import { styles as bootstrap } from './shared/chat-message/chat-message.bootstrap.css.js'; | ||
| import { styles as fluent } from './shared/chat-message/chat-message.fluent.css.js'; | ||
| import { styles as indigo } from './shared/chat-message/chat-message.indigo.css.js'; | ||
|
|
||
| const light = { | ||
| bootstrap: css` | ||
| ${bootstrap} | ||
| `, | ||
| indigo: css` | ||
| ${indigo} | ||
| `, | ||
| fluent: css` | ||
| ${fluent} | ||
| `, | ||
| }; | ||
|
|
||
| const dark = { | ||
| bootstrap: css` | ||
| ${bootstrap} | ||
| `, | ||
| indigo: css` | ||
| ${indigo} | ||
| `, | ||
| fluent: css` | ||
| ${fluent} | ||
| `, | ||
| }; | ||
|
|
||
| export const all: Themes = { light, dark }; |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,24 +1,36 @@ | ||||
| @use 'sass:map'; | ||||
|
||||
| @use 'sass:map'; |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| @use 'styles/utilities' as *; | ||
| @use '../../light/themes' as *; | ||
|
|
||
| [part~='sent'] { | ||
| border-radius: rem(8px); | ||
| $theme: $indigo; | ||
|
|
||
| :host { | ||
| --message-corner-radius: #{var-get($theme, 'message-border-radius')}; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isCurrentUserMessage(this.message)is computed twice when buildingparts. Consider storing the result in a localconst isSent = ...and deriving bothsent/receivedfrom it to avoid duplicate work and keep the logic easier to read.