Skip to content
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

Social: Add new connection modal #37211

Merged
merged 24 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2ac54d9
Add the constants
gmjuhasz May 3, 2024
9ff8f83
Chain down iconSize to SocialServiceIcon
gmjuhasz May 3, 2024
7ba255a
changelog
gmjuhasz May 3, 2024
6da7cb6
Add the connection modal
gmjuhasz May 3, 2024
f040608
Add the connect page component
gmjuhasz May 3, 2024
6615297
Add assets
gmjuhasz May 3, 2024
035cb6a
Add LinkedIn, Nextdoor, and Tumblr example
gmjuhasz May 6, 2024
08a9777
Add Mastodon
gmjuhasz May 6, 2024
e70fda9
Merge branch 'trunk' into add/social-add-connection-modal
gmjuhasz May 6, 2024
1d33c6f
Hook up the modal
gmjuhasz May 6, 2024
dc23280
Fixup versions
gmjuhasz May 6, 2024
9edd20f
Add aria-label to button
gmjuhasz May 7, 2024
2bfaeda
Update projects/js-packages/publicize-components/src/components/add-c…
gmjuhasz May 7, 2024
6444ce6
Update projects/js-packages/publicize-components/src/components/add-c…
gmjuhasz May 7, 2024
e9fbc4a
Update projects/js-packages/publicize-components/src/components/add-c…
gmjuhasz May 7, 2024
35afae9
Update projects/js-packages/publicize-components/src/components/add-c…
gmjuhasz May 7, 2024
f944912
Update projects/js-packages/publicize-components/src/components/add-c…
gmjuhasz May 7, 2024
d260429
Add connect button to main page as well
gmjuhasz May 7, 2024
8792b32
Merge branch 'trunk' into add/social-add-connection-modal
gmjuhasz May 7, 2024
6aff2e3
Fixup versions
gmjuhasz May 7, 2024
d791d72
Show `back` instead of chevronleft
gmjuhasz May 7, 2024
c45a42b
Fix TS compile error for image imports in js-packages
manzoorwanijk May 7, 2024
fef8379
Update projects/js-packages/publicize-components/src/components/add-c…
gmjuhasz May 7, 2024
7f8d947
Merge branch 'trunk' into add/social-add-connection-modal
gmjuhasz May 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Social: Added add connection modal
4 changes: 3 additions & 1 deletion projects/js-packages/components/components/icons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,13 @@ export function getIconBySlug< Slug extends IconSlug >( slug: Slug ): IconsMap[
export const SocialServiceIcon: React.FC< {
serviceName: React.ComponentProps< typeof SocialLogo >[ 'icon' ];
className?: string;
} > = ( { serviceName, className } ) => {
iconSize?: number;
} > = ( { serviceName, className, iconSize } ) => {
return (
<SocialLogo
className={ classNames( styles.socialIcon, styles[ serviceName ], className ) }
icon={ serviceName }
size={ iconSize || 24 }
/>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Social: Added add connection modal
1 change: 1 addition & 0 deletions projects/js-packages/publicize-components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export { default as ReviewPrompt } from './src/components/review-prompt';
export { default as PostPublishReviewPrompt } from './src/components/post-publish-review-prompt';
export { default as PostPublishManualSharing } from './src/components/post-publish-manual-sharing';
export { default as RefreshJetpackSocialSettingsWrapper } from './src/components/refresh-jetpack-social-settings';
export { default as AddConnectionModal } from './src/components/add-connection-modal';
export { default as ConnectionManagement } from './src/components/connection-management';

export { default as useSocialMediaConnections } from './src/hooks/use-social-media-connections';
Expand Down
2 changes: 1 addition & 1 deletion projects/js-packages/publicize-components/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-publicize-components",
"version": "0.50.0",
"version": "0.51.0-alpha",
"description": "A library of JS components required by the Publicize editor plugin",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/publicize-components/#readme",
"bugs": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module '*.png';
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 ? (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Mastodon we need to have the username as an input. We can handle that on the Button onClick event

<input
gmjuhasz marked this conversation as resolved.
Show resolved Hide resolved
required
type="text"
aria-label={ __( 'Mastodon username', 'jetpack' ) }
placeholder={ '@[email protected]' }
/>
) : null }
<Button type="submit" variant="primary">
{ __( 'Connect', 'jetpack' ) }
</Button>
</form>
</div>
</>
);
};
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;
}
}
Loading
Loading