Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 18
Feature/#144 add download button#145
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
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
80793b073f4fb42f70bb85343f3691c5481c808ae6File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| export * from './hooks'; | ||
| export * from './global-window'; | ||
| export * from './log-download' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| export const handleDownloadSessionContent = (sessionContent: string): void => | ||
| generateFile(sessionContent); | ||
| const generateFile = (txt: string): void => { | ||
| const file: Blob = new Blob([txt], { | ||
| type: 'text/plain;charset=utf-8', | ||
| }); | ||
| const element: HTMLAnchorElement = document.createElement('a'); | ||
| element.href = URL.createObjectURL(file); | ||
| element.download = generateCodePasterFileName(); | ||
| element.click(); | ||
| }; | ||
| const generateCodePasterFileName = (): string => { | ||
| const dateToday = new Date(Date.now()).toLocaleDateString(); | ||
| return `Codepaster_Session_${dateToday}.txt`; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -53,3 +53,45 @@ export const textarea = css` | ||
| outline: none; | ||
| } | ||
| `; | ||
| export const downloadButton = css` | ||
| display: flex; | ||
| align-items: left; | ||
| width: 100%; | ||
| padding: ${spacing(1.25)} ${spacing(1.875)}; | ||
| flex: 1; | ||
| font-size: 1.188rem; | ||
| font-weight: 400; | ||
| text-transform: capitalize; | ||
| border-radius: 0; | ||
| color: ${color.blueDark}; | ||
| background-color: white; | ||
| border: 2px solid ${color.blueDark}; | ||
| transition: all 0.2s; | ||
| &:hover, | ||
| &:active { | ||
| color: white; | ||
| background-color: ${color.blueDark}; | ||
| border: 2px solid ${color.blueDark}; | ||
| outline: none; | ||
| } | ||
| @media (min-width: ${breakpoints.values.xs}px) { | ||
| max-width: ${spacing(20)}; | ||
| } | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this be simplified since we are using material ui? Author There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added spacing method instead of "50%" | ||
| `; | ||
| export const downloadIcon = css` | ||
| margin-right: ${spacing(1.25)}; | ||
| font-size: 1.25rem; | ||
| display: none; | ||
| @media (min-width: ${breakpoints.values.xs}px) { | ||
| display: initial; | ||
| } | ||
| `; | ||
| export const buttonScroll = css` | ||
| @media (min-width: ${breakpoints.values.xs}px) { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| } | ||
| `; | ||
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.
This is not using prettier formatting, @manudous will guide you setting up this
https://www.lemoncode.tv/curso/prettier