-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(embed-wizard): implement wizard menu
- Loading branch information
1 parent
221f493
commit ba920c5
Showing
27 changed files
with
488 additions
and
75 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {AppElementsState} from '../types/embed-elements'; | ||
|
||
export const TOGGLE_APP_ELEMENTS = 'TOGGLE_APP_ELEMENTS'; | ||
|
||
export interface SetAppElementsAction { | ||
type: typeof TOGGLE_APP_ELEMENTS; | ||
appElements: AppElementsState; | ||
} | ||
|
||
export function setAppElementsAction( | ||
appElements: AppElementsState | ||
): SetAppElementsAction { | ||
return { | ||
type: TOGGLE_APP_ELEMENTS, | ||
appElements | ||
}; | ||
} | ||
|
||
export default setAppElementsAction; |
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
20 changes: 20 additions & 0 deletions
20
src/scripts/components/main/embed-checkbox-list/embed-checkbox-list.module.styl
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,20 @@ | ||
@require '../../../../variables.styl' | ||
|
||
.checkboxList | ||
display: flex | ||
flex-direction: column | ||
gap: emCalc(16px) | ||
|
||
.checkboxListItem | ||
display: flex | ||
align-items: center | ||
gap: emCalc(8px) | ||
|
||
input[type='checkbox'] | ||
margin-left: 0 | ||
width: remCalc(20px) | ||
height: remCalc(20px) | ||
accent-color: $textWhite | ||
|
||
label | ||
color: $textDefault |
45 changes: 45 additions & 0 deletions
45
src/scripts/components/main/embed-checkbox-list/embed-checkbox-list.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,45 @@ | ||
import React, {FunctionComponent} from 'react'; | ||
|
||
import styles from './embed-checkbox-list.module.styl'; | ||
import {ElementOptions} from '../../../types/embed-elements'; | ||
|
||
interface Props { | ||
elementsChecked: ElementOptions; | ||
handleChange: (elements: ElementOptions) => void; | ||
} | ||
|
||
const EmbedCheckboxList: FunctionComponent<Props> = ({ | ||
elementsChecked, | ||
handleChange | ||
}) => { | ||
const convertToTitleCase = (inputString: string) => | ||
inputString | ||
.split('_') | ||
.map(word => word.charAt(0).toUpperCase() + word.slice(1)) | ||
.join(' '); | ||
|
||
return ( | ||
<div className={styles.checkboxList}> | ||
{Object.keys(elementsChecked).map(element => ( | ||
<div className={styles.checkboxListItem} key={element}> | ||
<input | ||
type="checkbox" | ||
name={element} | ||
checked={elementsChecked[element] === true} | ||
onChange={event => { | ||
const checked = event.target.checked; | ||
|
||
handleChange({ | ||
...elementsChecked, | ||
[element]: checked | ||
}); | ||
}} | ||
/> | ||
<label htmlFor={element}>{convertToTitleCase(element)}</label> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default EmbedCheckboxList; |
40 changes: 40 additions & 0 deletions
40
src/scripts/components/main/embed-result/embed-result.module.styl
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,40 @@ | ||
@require '../../../../variables.styl' | ||
|
||
.result | ||
grid-area: 2 / 1 / 3 / 2 | ||
|
||
.resultItem | ||
display: flex | ||
flex-direction: column | ||
|
||
.embedTextArea, .embedLinkTextArea | ||
padding: emCalc(16px) | ||
height: emCalc(171px) | ||
border-radius: 4px | ||
background: $black | ||
color: $textDefault | ||
font-weight: 400 | ||
font-style: normal | ||
font-size: emCalc(16px) | ||
font-family: Arial | ||
line-height: emCalc(22px) | ||
resize: none | ||
|
||
.embedLinkTextArea | ||
overflow-y: hidden | ||
height: emCalc(20px) | ||
|
||
.copyButton | ||
flex-direction: row-reverse | ||
align-self: flex-start | ||
margin: emCalc(16px) | ||
color: $main | ||
|
||
> svg | ||
fill: $main | ||
|
||
.copyButton:hover | ||
color: $textWhite | ||
|
||
> svg | ||
fill: $textWhite |
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,49 @@ | ||
import React, {FunctionComponent} from 'react'; | ||
import {FormattedMessage} from 'react-intl'; | ||
|
||
import Button from '../button/button'; | ||
import {CopyTextIcon} from '../icons/copy-text-icon'; | ||
|
||
import styles from './embed-result.module.styl'; | ||
|
||
interface Props { | ||
paramsString: string; | ||
} | ||
const EmbedResult: FunctionComponent<Props> = ({paramsString}) => ( | ||
<div className={styles.result}> | ||
<div className={styles.resultItem}> | ||
<h2> | ||
<FormattedMessage id={'embedCode'} /> | ||
</h2> | ||
<textarea | ||
className={styles.embedTextArea} | ||
value={paramsString} | ||
readOnly | ||
/> | ||
<Button | ||
className={styles.copyButton} | ||
icon={CopyTextIcon} | ||
label="copyEmbedCode" | ||
/> | ||
</div> | ||
|
||
<div className={styles.resultItem}> | ||
<h2> | ||
<FormattedMessage id={'embedLink'} /> | ||
</h2> | ||
<textarea | ||
className={styles.embedLinkTextArea} | ||
value={paramsString} | ||
wrap="off" | ||
readOnly | ||
/> | ||
<Button | ||
className={styles.copyButton} | ||
icon={CopyTextIcon} | ||
label="copyEmbedLink" | ||
/> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default EmbedResult; |
17 changes: 17 additions & 0 deletions
17
src/scripts/components/main/embed-wizard/embed-wizard.module.styl
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,17 @@ | ||
@require '../../../../variables.styl' | ||
|
||
.embedWizard | ||
display: grid | ||
align-items: start | ||
width: 60% | ||
color: $textWhite | ||
column-gap: emCalc(50px) | ||
grid-template-columns: repeat(2, auto) | ||
grid-template-rows: repeat(3, auto) | ||
row-gap: emCalc(20px) | ||
|
||
.header | ||
grid-area: 1 / 1 / 2 / 3 | ||
|
||
.settings | ||
display: grid |
Oops, something went wrong.