-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: [M3-8775] - Make the Support Ticket UI look slightly less b…
…roken (#11144) * initial work * fix more ui * add changeset * fix padding on preview paper * feedback @mjac0bs * fix top padding @harsh-akamai --------- Co-authored-by: Banks Nussman <banks@nussman.us>
- Loading branch information
1 parent
85edbfc
commit 427b55c
Showing
7 changed files
with
95 additions
and
167 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-11144-changed-1729684811107.md
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 @@ | ||
--- | ||
"@linode/manager": Changed | ||
--- | ||
|
||
Slightly improve styles on support ticket flows ([#11144](https://github.com/linode/manager/pull/11144)) |
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
58 changes: 24 additions & 34 deletions
58
packages/manager/src/features/Support/SupportTicketDetail/TabbedReply/MarkdownReference.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 |
---|---|---|
@@ -1,66 +1,56 @@ | ||
import * as React from 'react'; | ||
import { makeStyles } from 'tss-react/mui'; | ||
|
||
import { HighlightedMarkdown } from 'src/components/HighlightedMarkdown/HighlightedMarkdown'; | ||
import { Link } from 'src/components/Link'; | ||
import { Paper } from 'src/components/Paper'; | ||
import { Stack } from 'src/components/Stack'; | ||
import { Typography } from 'src/components/Typography'; | ||
|
||
import type { Theme } from '@mui/material/styles'; | ||
|
||
const useStyles = makeStyles()((theme: Theme) => ({ | ||
example: { | ||
backgroundColor: theme.name === 'dark' ? theme.bg.white : theme.bg.offWhite, | ||
margin: `${theme.spacing(2)} 0`, | ||
padding: theme.spacing(2), | ||
}, | ||
header: { | ||
marginBottom: theme.spacing(), | ||
marginTop: theme.spacing(2), | ||
}, | ||
})); | ||
|
||
interface Props { | ||
isReply?: boolean; | ||
rootClass?: string; | ||
} | ||
|
||
export const MarkdownReference = (props: Props) => { | ||
const { classes } = useStyles(); | ||
|
||
return ( | ||
<div className={props.rootClass}> | ||
<Stack spacing={2}> | ||
<Typography> | ||
You can use Markdown to format your{' '} | ||
{props.isReply ? 'reply' : 'question'}. For more examples see this{' '} | ||
{props.isReply ? 'reply' : 'question'}. For more examples, see this{' '} | ||
<Link external to="https://commonmark.org/help/"> | ||
Markdown cheatsheet | ||
</Link> | ||
</Typography> | ||
<Typography className={classes.header}> | ||
<strong>Examples</strong> | ||
</Typography> | ||
<div className={classes.example}> | ||
<Typography fontFamily={(theme) => theme.font.bold}>Examples</Typography> | ||
<Paper | ||
sx={(theme) => ({ | ||
backgroundColor: theme.palette.background.default, | ||
p: 2, | ||
})} | ||
> | ||
<Typography>[I am a link](https://google.com)</Typography> | ||
<br /> | ||
<Typography | ||
dangerouslySetInnerHTML={{ | ||
__html: '<a>I am a link</a>', | ||
}} | ||
/> | ||
</div> | ||
<div className={classes.example}> | ||
</Paper> | ||
<Paper | ||
sx={(theme) => ({ | ||
backgroundColor: theme.palette.background.default, | ||
p: 2, | ||
})} | ||
> | ||
<Typography> | ||
``` | ||
```js | ||
<br /> | ||
const someCode = 'hello world'; | ||
<br /> | ||
``` | ||
</Typography> | ||
<Typography | ||
dangerouslySetInnerHTML={{ | ||
__html: `<pre style="white-space: pre-wrap;">const someCode = "hello world"</pre>`, | ||
}} | ||
<HighlightedMarkdown | ||
textOrMarkdown={'```ts\nconst someCode = "hello world"\n```'} | ||
/> | ||
</div> | ||
</div> | ||
</Paper> | ||
</Stack> | ||
); | ||
}; |
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
66 changes: 24 additions & 42 deletions
66
packages/manager/src/features/Support/SupportTicketDetail/TabbedReply/TabbedReply.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 |
---|---|---|
@@ -1,58 +1,40 @@ | ||
import { Theme } from '@mui/material/styles'; | ||
import { makeStyles } from 'tss-react/mui'; | ||
import * as React from 'react'; | ||
import React from 'react'; | ||
|
||
import { Tab, TabbedPanel } from 'src/components/TabbedPanel/TabbedPanel'; | ||
import { SafeTabPanel } from 'src/components/Tabs/SafeTabPanel'; | ||
import { Tab } from 'src/components/Tabs/Tab'; | ||
import { TabList } from 'src/components/Tabs/TabList'; | ||
import { TabPanels } from 'src/components/Tabs/TabPanels'; | ||
import { Tabs } from 'src/components/Tabs/Tabs'; | ||
|
||
import { PreviewReply } from './PreviewReply'; | ||
import { Props as ReplyProps, TicketReply } from './TicketReply'; | ||
import { TicketReply } from './TicketReply'; | ||
|
||
import type { Props as ReplyProps } from './TicketReply'; | ||
|
||
interface Props extends ReplyProps { | ||
innerClass?: string; | ||
isReply?: boolean; | ||
required?: boolean; | ||
rootClass?: string; | ||
} | ||
|
||
const useStyles = makeStyles()((theme: Theme) => ({ | ||
root: { | ||
'& div[role="tablist"]': { | ||
marginBottom: theme.spacing(), | ||
marginTop: theme.spacing(), | ||
}, | ||
backgroundColor: 'transparent', | ||
padding: 0, | ||
}, | ||
})); | ||
|
||
export const TabbedReply = (props: Props) => { | ||
const { classes } = useStyles(); | ||
const { error, innerClass, rootClass, value, ...rest } = props; | ||
const { error, value, ...rest } = props; | ||
|
||
const title = props.isReply ? 'Reply' : 'Description'; | ||
|
||
const tabs: Tab[] = [ | ||
{ | ||
render: () => { | ||
return <TicketReply {...rest} error={error} value={value} />; | ||
}, | ||
title: props.required ? `${title} (required)` : title, | ||
}, | ||
{ | ||
render: () => { | ||
return <PreviewReply error={error} value={value} />; | ||
}, | ||
title: 'Preview', | ||
}, | ||
]; | ||
|
||
return ( | ||
<TabbedPanel | ||
header="" | ||
innerClass={innerClass} | ||
noPadding | ||
rootClass={rootClass || classes.root} | ||
tabs={tabs} | ||
/> | ||
<Tabs> | ||
<TabList> | ||
<Tab>{props.required ? `${title} (required)` : title}</Tab> | ||
<Tab>Preview</Tab> | ||
</TabList> | ||
<TabPanels> | ||
<SafeTabPanel index={0}> | ||
<TicketReply {...rest} error={error} value={value} /> | ||
</SafeTabPanel> | ||
<SafeTabPanel index={1}> | ||
<PreviewReply error={error} value={value} /> | ||
</SafeTabPanel> | ||
</TabPanels> | ||
</Tabs> | ||
); | ||
}; |
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