/
githubmirror
/
wp-calypso
Обзор
Документация
Войти
/
githubmirror
/
wp-calypso
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
client/reader/lib/content-width/index.js
26 строк
723 B
Sergio Cinos
chore: Fix eslint rule jsdoc/no-undefined-types (#56607)
28 сен 2021, 16:00
Не верифицирован
28 сен 2021, 16:00
671f07d
Код
Авторство
О чём код?
const PAGE_MARGIN_LARGE = 32 * 2; const PAGE_MARGIN_MEDIUM = 24 * 2; const PAGE_MARGIN_SMALL = 10 * 2; const SIDEBAR_WIDTH = 240; const MAX_CONTENT_WIDTH = 720; /** * Returns the available content width in full post for the reader at the current viewport width */ export default function contentWidth() { if ( typeof document === 'undefined' ) { return undefined; } const clientWidth = document.documentElement.clientWidth; if ( clientWidth > 1040 ) { return MAX_CONTENT_WIDTH; } if ( clientWidth > 928 ) { return clientWidth - ( SIDEBAR_WIDTH + PAGE_MARGIN_LARGE ); } if ( clientWidth > 660 ) { return clientWidth - ( SIDEBAR_WIDTH + PAGE_MARGIN_MEDIUM ); } return clientWidth - PAGE_MARGIN_SMALL; }