-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Social: Add new connection modal (#37211)
* Add the constants * Chain down iconSize to SocialServiceIcon * changelog * Add the connection modal * Add the connect page component * Add assets * Add LinkedIn, Nextdoor, and Tumblr example * Add Mastodon * Hook up the modal * Fixup versions * Add aria-label to button * Update projects/js-packages/publicize-components/src/components/add-connection-modal/connect-page/style.module.scss Co-authored-by: Manzoor Wani <[email protected]> * Update projects/js-packages/publicize-components/src/components/add-connection-modal/style.module.scss Co-authored-by: Manzoor Wani <[email protected]> * Update projects/js-packages/publicize-components/src/components/add-connection-modal/style.module.scss Co-authored-by: Manzoor Wani <[email protected]> * Update projects/js-packages/publicize-components/src/components/add-connection-modal/style.module.scss Co-authored-by: Manzoor Wani <[email protected]> * Update projects/js-packages/publicize-components/src/components/add-connection-modal/constants.tsx Co-authored-by: Manzoor Wani <[email protected]> * Add connect button to main page as well * Fixup versions * Show `back` instead of chevronleft * Fix TS compile error for image imports in js-packages * Update projects/js-packages/publicize-components/src/components/add-connection-modal/index.tsx Co-authored-by: Manzoor Wani <[email protected]> --------- Co-authored-by: Manzoor Wani <[email protected]>
- Loading branch information
Showing
24 changed files
with
563 additions
and
7 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
projects/js-packages/components/changelog/add-social-add-connection-modal
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,4 @@ | ||
Significance: minor | ||
Type: added | ||
|
||
Social: Added add connection modal |
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
4 changes: 4 additions & 0 deletions
4
projects/js-packages/publicize-components/changelog/add-social-add-connection-modal
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,4 @@ | ||
Significance: minor | ||
Type: added | ||
|
||
Social: Added add connection modal |
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
Binary file added
BIN
+11.8 KB
...cts/js-packages/publicize-components/src/assets/connections-button-facebook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.9 KB
...cts/js-packages/publicize-components/src/assets/connections-button-linkedin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.9 KB
projects/js-packages/publicize-components/src/assets/connections-button-tumblr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+79.7 KB
projects/js-packages/publicize-components/src/assets/connections-facebook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+75.6 KB
.../js-packages/publicize-components/src/assets/connections-instagram-business.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+72.5 KB
projects/js-packages/publicize-components/src/assets/connections-linkedin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+65.7 KB
projects/js-packages/publicize-components/src/assets/connections-nextdoor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+62.1 KB
projects/js-packages/publicize-components/src/assets/connections-tumblr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
projects/js-packages/publicize-components/src/assets/index.d.ts
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 @@ | ||
declare module '*.png'; |
52 changes: 52 additions & 0 deletions
52
...es/publicize-components/src/components/add-connection-modal/connect-page/connect-page.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,52 @@ | ||
import { Button, useBreakpointMatch } from '@automattic/jetpack-components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import classNames from 'classnames'; | ||
import { Connection } from '../constants'; | ||
import styles from './style.module.scss'; | ||
|
||
type ConnectPageProps = { | ||
service: Connection; | ||
onBackClicked: () => void; | ||
}; | ||
|
||
export const ConnectPage: React.FC< ConnectPageProps > = ( { service, onBackClicked } ) => { | ||
const [ isSmall ] = useBreakpointMatch( 'sm' ); | ||
|
||
return ( | ||
<> | ||
<div | ||
className={ classNames( styles[ 'example-wrapper' ], { | ||
[ styles.small ]: isSmall, | ||
} ) } | ||
> | ||
{ service.examples.map( ( Example, idx ) => ( | ||
<div key={ service.name + idx } className={ styles.example }> | ||
<Example /> | ||
</div> | ||
) ) } | ||
</div> | ||
<div className={ styles[ 'actions-wrapper' ] }> | ||
<Button | ||
variant="secondary" | ||
onClick={ onBackClicked } | ||
aria-label={ __( 'Go back', 'jetpack' ) } | ||
> | ||
{ __( 'Back', 'jetpack' ) } | ||
</Button> | ||
<form className={ classNames( styles[ 'connect-form' ], { [ styles.small ]: isSmall } ) }> | ||
{ 'mastodon' === service.name ? ( | ||
<input | ||
required | ||
type="text" | ||
aria-label={ __( 'Mastodon username', 'jetpack' ) } | ||
placeholder={ '@[email protected]' } | ||
/> | ||
) : null } | ||
<Button type="submit" variant="primary"> | ||
{ __( 'Connect', 'jetpack' ) } | ||
</Button> | ||
</form> | ||
</div> | ||
</> | ||
); | ||
}; |
53 changes: 53 additions & 0 deletions
53
...s/publicize-components/src/components/add-connection-modal/connect-page/style.module.scss
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,53 @@ | ||
.example-wrapper { | ||
display: grid; | ||
grid-auto-columns: minmax(0, 1fr); | ||
grid-auto-flow: column; | ||
font-size: 15px; | ||
margin-top: 0.4rem; | ||
min-height: 300px; | ||
|
||
&.small { | ||
grid-auto-flow: row; | ||
grid-gap: 2rem; | ||
height: auto; | ||
min-height: unset; | ||
} | ||
|
||
img { | ||
max-height: 520px; | ||
max-width: 100%; | ||
} | ||
|
||
> div { | ||
padding: 0.4rem; | ||
|
||
&:has(img) { | ||
margin-inline-start: auto; | ||
margin-inline-end: auto; | ||
} | ||
} | ||
} | ||
|
||
.actions-wrapper { | ||
display: flex; | ||
justify-content: space-between; | ||
margin-top: 1rem; | ||
} | ||
|
||
.chevron-back { | ||
display: block; | ||
} | ||
|
||
.connect-form { | ||
display: grid; | ||
gap: 0.5rem; | ||
|
||
& > input { | ||
height: 100%; | ||
width: 18rem; | ||
} | ||
|
||
&:not(.small) { | ||
grid-auto-flow: column; | ||
} | ||
} |
Oops, something went wrong.