Skip to content

Commit

Permalink
[PAY-1350] Update send button styling on web (#3523)
Browse files Browse the repository at this point in the history
Co-authored-by: Marcus Pasell <3690498+rickyrombo@users.noreply.github.com>
  • Loading branch information
piazzatron and rickyrombo committed Jun 7, 2023
1 parent 238f352 commit 100a4d6
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,9 @@
align-items: flex-end;
gap: var(--unit-1);
}

.children {
display: flex;
align-items: center;
overflow: visible;
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ export const TextAreaV2 = (props: TextAreaV2Props) => {
/>
<div className={styles.bottom}>
<div className={styles.bottomRight}>
<div className={styles.children}>{children}</div>
<div
className={styles.children}
style={{ height: `${sizeToLineHeight[size]}px` }}
>
{children}
</div>
{showMaxLength ? (
<div
className={cn(styles.characterCount, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,45 @@
padding: var(--unit-2) var(--unit-4);
}

.input {
padding: var(--unit-2) var(--unit-4);
}

.icon {
width: 1.5em;
height: 1.5em;
display: block; /* Prevent descender space */
width: var(--unit-5);
height: var(--unit-5);
/* 1 pixel nudge to visually center */
position: relative;
left: -1px;
}

.icon path {
fill: var(--primary);
fill: var(--static-white);
}

button.sendButton {
display: block; /* Prevent descender space */
display: flex;
justify-content: center;
align-items: center;
height: var(--unit-8);
width: var(--unit-8);
border-radius: var(--unit-4);
background-color: var(--primary);
transform: scale(1);
transition: all var(--quick);
}

button.sendButton:not(:disabled):hover {
transform: scale(1.05);
background-color: var(--primary-light-2);
}

button.sendButton:not(:disabled):active {
background-color: var(--primary-dark-2);
transform: scale(0.95);
}

.sendButton:not(:disabled) .icon:hover path {
fill: var(--secondary);
button.sendButton:disabled,
button.sendButton:disabled .icon path {
opacity: 0.5;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ export type ChatComposerProps = ComponentPropsWithoutRef<'div'> & {

const MAX_MESSAGE_LENGTH = 10000

type ChatSendButtonProps = { disabled: boolean }

export const ChatSendButton = ({ disabled }: ChatSendButtonProps) => {
return (
<IconButton
className={styles.sendButton}
disabled={disabled}
aria-label={messages.sendMessage}
type={'submit'}
icon={<IconSend className={styles.icon} />}
/>
)
}

export const ChatComposer = (props: ChatComposerProps) => {
const { chatId } = props
const dispatch = useDispatch()
Expand Down Expand Up @@ -81,13 +95,7 @@ export const ChatComposer = (props: ChatComposerProps) => {
grows
resize
>
<IconButton
className={styles.sendButton}
disabled={!value}
aria-label={messages.sendMessage}
type={'submit'}
icon={<IconSend className={styles.icon} />}
/>
<ChatSendButton disabled={!value} />
</TextAreaV2>
</form>
</div>
Expand Down

0 comments on commit 100a4d6

Please sign in to comment.