-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(side-panel): add SidePanelFooter (#4002)
* chore(ai-chat-log): remove padding-x from log * feat(side-panel): create SidePanelFooter * chore(side-modal): align design with side panel design * docs(side-panel, side-modal): add footer examples to docs * chore(chat-composer): make container 100% width * chore(side-modal): remove changes to footer actions alignment * chore(side-panel): allow justification of footer content * chore: typedocs * chore: pr feedback
- Loading branch information
Showing
23 changed files
with
2,009 additions
and
122 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@twilio-paste/ai-chat-log": patch | ||
"@twilio-paste/core": patch | ||
--- | ||
|
||
[AI Chat Log] Remove padding-x on AI Chat Log to prevent double padding when log is used within a Side Panel container. |
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,6 @@ | ||
--- | ||
"@twilio-paste/chat-composer": patch | ||
"@twilio-paste/core": patch | ||
--- | ||
|
||
[Chat Composer] Add width="100%" to ChatComposerContainer to prevent composer from shrinking when no value |
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,6 @@ | ||
--- | ||
"@twilio-paste/side-modal": patch | ||
"@twilio-paste/core": patch | ||
--- | ||
|
||
[Side Modal] Increase size of close icon. |
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,5 @@ | ||
--- | ||
"@twilio-paste/codemods": patch | ||
--- | ||
|
||
[Codemods] New export from side-panel package |
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,6 @@ | ||
--- | ||
"@twilio-paste/side-panel": minor | ||
"@twilio-paste/core": minor | ||
--- | ||
|
||
[Side Panel] Create SidePanelFooter exported from the Side Panel package for actions or chat composers. Make scrollbar color of SidePanelBody slightly darker for better visibility. Small improvements to spacing and alignment of SidePanelHeader. |
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
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
34 changes: 34 additions & 0 deletions
34
packages/paste-core/components/side-panel/src/SidePanelFooter.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,34 @@ | ||
import { Box, safelySpreadBoxProps } from "@twilio-paste/box"; | ||
import * as React from "react"; | ||
|
||
import type { SidePanelFooterProps } from "./types"; | ||
|
||
const SidePanelFooter = React.forwardRef<HTMLDivElement, SidePanelFooterProps>( | ||
({ element = "SIDE_PANEL_FOOTER", variant = "default", children, justifyContent = "flex-start", ...props }, ref) => { | ||
return ( | ||
<Box | ||
width="100%" | ||
paddingX={variant === "chat" ? "space50" : "space70"} | ||
paddingBottom="space50" | ||
paddingTop={variant === "chat" ? "space0" : "space50"} | ||
boxShadow={variant === "chat" ? "none" : "shadow"} | ||
marginBottom="spaceNegative70" | ||
zIndex="zIndex20" | ||
display="flex" | ||
columnGap="space40" | ||
rowGap="space40" | ||
justifyContent={justifyContent} | ||
flexWrap="wrap" | ||
{...safelySpreadBoxProps(props)} | ||
ref={ref} | ||
element={element} | ||
> | ||
{children} | ||
</Box> | ||
); | ||
}, | ||
); | ||
|
||
SidePanelFooter.displayName = "SidePanelFooter"; | ||
|
||
export { SidePanelFooter }; |
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
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
95 changes: 95 additions & 0 deletions
95
packages/paste-core/components/side-panel/stories/components/SidePanelWithAIContent.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,95 @@ | ||
// eslint-disable-next-line eslint-comments/disable-enable-pair | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { AIChatLog, AIChatMessage, AIChatMessageAuthor, AIChatMessageBody } from "@twilio-paste/ai-chat-log"; | ||
import { Anchor } from "@twilio-paste/anchor"; | ||
import { Box } from "@twilio-paste/box"; | ||
import { Button } from "@twilio-paste/button"; | ||
import { ChatComposer, ChatComposerActionGroup, ChatComposerContainer } from "@twilio-paste/chat-composer"; | ||
import { Heading } from "@twilio-paste/heading"; | ||
import { ArtificialIntelligenceIcon } from "@twilio-paste/icons/esm/ArtificialIntelligenceIcon"; | ||
import { AttachIcon } from "@twilio-paste/icons/esm/AttachIcon"; | ||
import { MoreIcon } from "@twilio-paste/icons/esm/MoreIcon"; | ||
import { SendIcon } from "@twilio-paste/icons/esm/SendIcon"; | ||
import { Separator } from "@twilio-paste/separator"; | ||
import * as React from "react"; | ||
|
||
import { SidePanel, SidePanelBody, SidePanelFooter, SidePanelHeader, SidePanelHeaderActions } from "../../src"; | ||
|
||
export const SidePanelWithAIContent: React.FC<React.PropsWithChildren> = () => { | ||
return ( | ||
<SidePanel label="intelligent assistant ai bot side panel"> | ||
<SidePanelHeader> | ||
<ArtificialIntelligenceIcon decorative size="sizeIcon50" color="colorTextIcon" /> | ||
<Heading as="h3" variant="heading30" marginBottom="space0"> | ||
Assistant | ||
</Heading> | ||
<SidePanelHeaderActions> | ||
<Button variant="secondary_icon" size="reset" onClick={() => {}}> | ||
<MoreIcon decorative={false} title="open menu" size="sizeIcon50" /> | ||
</Button> | ||
</SidePanelHeaderActions> | ||
</SidePanelHeader> | ||
<Separator orientation="horizontal" verticalSpacing="space0" /> | ||
<SidePanelBody> | ||
<Box width="100%"> | ||
<AIChatLog> | ||
<AIChatMessage variant="bot"> | ||
<AIChatMessageAuthor aria-label="ai said">Good Bot</AIChatMessageAuthor> | ||
<AIChatMessageBody>Hello, what can I help you with?</AIChatMessageBody> | ||
</AIChatMessage> | ||
<AIChatMessage variant="user"> | ||
<AIChatMessageAuthor aria-label="You said at 2:36pm">Gibby Radki</AIChatMessageAuthor> | ||
<AIChatMessageBody>Hi! Can you help me with my user interface?</AIChatMessageBody> | ||
</AIChatMessage> | ||
<AIChatMessage variant="bot"> | ||
<AIChatMessageAuthor aria-label="ai said">Good Bot</AIChatMessageAuthor> | ||
Of course! What do you need help with? | ||
</AIChatMessage> | ||
<AIChatMessage variant="bot"> | ||
<AIChatMessageAuthor aria-label="ai said">Good Bot</AIChatMessageAuthor> | ||
<AIChatMessageBody> | ||
I'm happy to help with any questions you have about user interfaces, accessibility, or the Twilio | ||
Paste design system. Just ask! | ||
</AIChatMessageBody> | ||
</AIChatMessage> | ||
<AIChatMessage variant="user"> | ||
<AIChatMessageAuthor aria-label="You said at 2:39pm">Gibby Radki</AIChatMessageAuthor> | ||
<AIChatMessageBody>My question is about the Switch component.</AIChatMessageBody> | ||
</AIChatMessage> | ||
<AIChatMessage variant="bot"> | ||
<AIChatMessageAuthor aria-label="ai said">Good Bot</AIChatMessageAuthor> | ||
<AIChatMessageBody> | ||
A <Anchor href="https://paste.twilio.design/components/switch">Switch</Anchor> is an interactive binary | ||
control. What other information about the Paste Switch component can I help with? | ||
</AIChatMessageBody> | ||
</AIChatMessage> | ||
</AIChatLog> | ||
</Box> | ||
</SidePanelBody> | ||
<SidePanelFooter variant="chat"> | ||
<ChatComposerContainer variant="contained"> | ||
<ChatComposer | ||
maxHeight="size10" | ||
config={{ | ||
namespace: "customer-chat", | ||
onError: (e) => { | ||
throw e; | ||
}, | ||
}} | ||
initialValue="Are switch labels required? What about " | ||
placeholder="Chat text" | ||
ariaLabel="A basic chat composer" | ||
/> | ||
<ChatComposerActionGroup> | ||
<Button variant="secondary_icon" size="reset"> | ||
<AttachIcon decorative={false} title="attach files to the message" /> | ||
</Button> | ||
<Button variant="primary_icon" size="reset"> | ||
<SendIcon decorative={false} title="Send" /> | ||
</Button> | ||
</ChatComposerActionGroup> | ||
</ChatComposerContainer> | ||
</SidePanelFooter> | ||
</SidePanel> | ||
); | ||
}; |
Oops, something went wrong.