| 1 |
import { useDispatch, useSelect } from '@wordpress/data'; |
| 2 |
|
| 3 |
const { ghostkitVariables } = window; |
| 4 |
|
| 5 |
const allDevices = { ...ghostkitVariables.media_sizes }; |
| 6 |
|
| 7 |
export default function useResponsive() { |
| 8 |
const { device } = useSelect((select) => { |
| 9 |
const { getDevice } = select('ghostkit/responsive'); |
| 10 |
|
| 11 |
return { |
| 12 |
device: getDevice(), |
| 13 |
}; |
| 14 |
}); |
| 15 |
|
| 16 |
const { setDevice } = useDispatch('ghostkit/responsive'); |
| 17 |
|
| 18 |
return { |
| 19 |
device, |
| 20 |
setDevice, |
| 21 |
allDevices, |
| 22 |
}; |
| 23 |
} |
| 24 |
|