Skip to content

Commit

Permalink
Merge pull request #3657 from 10up/feature/sync-page-ui
Browse files Browse the repository at this point in the history
New Sync page with advanced options
  • Loading branch information
felipeelia authored Sep 27, 2023
2 parents 3824626 + 7c9db8d commit 24aa4a0
Show file tree
Hide file tree
Showing 55 changed files with 1,173 additions and 1,101 deletions.
18 changes: 0 additions & 18 deletions assets/css/sync.css

This file was deleted.

25 changes: 0 additions & 25 deletions assets/css/sync/button.css

This file was deleted.

16 changes: 0 additions & 16 deletions assets/css/sync/controls.css

This file was deleted.

12 changes: 0 additions & 12 deletions assets/css/sync/heading.css

This file was deleted.

34 changes: 0 additions & 34 deletions assets/css/sync/panel.css

This file was deleted.

23 changes: 0 additions & 23 deletions assets/css/sync/status.css

This file was deleted.

10 changes: 0 additions & 10 deletions assets/css/sync/warning.css

This file was deleted.

65 changes: 65 additions & 0 deletions assets/js/settings-screen/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* WordPress dependencies.
*/
import { SnackbarList } from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import { createContext, useContext, useMemo, WPElement } from '@wordpress/element';
import { store as noticeStore } from '@wordpress/notices';

/**
* Internal dependencies.
*/
import './style.css';

const Context = createContext();

/**
* ElasticPress Settings Screen provider component.
*
* @param {object} props Component props.
* @param {WPElement} props.children Component children.
* @param {string} props.title Page title.
* @returns {WPElement} Sync page component.
*/
export const SettingsScreenProvider = ({ children, title }) => {
const { createNotice, removeNotice } = useDispatch(noticeStore);

const { notices } = useSelect((select) => {
return {
notices: select(noticeStore).getNotices(),
};
}, []);

const contextValue = useMemo(
() => ({
createNotice,
removeNotice,
}),
[createNotice, removeNotice],
);

return (
<Context.Provider value={contextValue}>
<div className="ep-settings-page">
<div className="ep-settings-page__wrap">
<h1 className="ep-settings-page__title">{title}</h1>
{children}
</div>
<SnackbarList
className="ep-settings-page__snackbar-list"
notices={notices}
onRemove={(notice) => removeNotice(notice)}
/>
</div>
</Context.Provider>
);
};

/**
* Use the Settings Page.
*
* @returns {object} Settings Page Context.
*/
export const useSettingsScreen = () => {
return useContext(Context);
};
17 changes: 17 additions & 0 deletions assets/js/settings-screen/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.ep-settings-page__wrap {
margin-left: auto;
margin-right: auto;
max-width: 800px;
}

.ep-settings-page__snackbar-list {
bottom: 40px;
left: 0;
padding: 0 16px;
position: fixed;

@media (min-width: 600px) {
left: auto;
padding: 0;
}
}
147 changes: 0 additions & 147 deletions assets/js/sync-ui/apps/settings-page.js

This file was deleted.

Loading

0 comments on commit 24aa4a0

Please sign in to comment.