@atlaskit/navigation-system
Version:
Page layout and navigation components for Atlassian apps.
43 lines • 1.8 kB
JavaScript
import React from 'react';
/**
* Size queries cannot use a CSS variable for their threshold in supported browsers.
* Keep this exception limited to the configured breakpoint and SSR layout inputs;
* Root and ChatPanel own the static layout, appearance and motion styles.
*/
export function ChatPanelResponsiveStyles({
gridRootId,
gridRootFitId,
compactDefaultWidth,
defaultWidth,
compactPreferredWidth,
preferredWidth,
minWidth,
hasBorder
}) {
return (
/*#__PURE__*/
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles -- Runtime size-query threshold and SSR inputs cannot be expressed in static Compiled styles.
React.createElement("style", null, `
#${gridRootFitId} { --n_chatDefaultW: ${compactDefaultWidth}px; --n_chatPreferredW: ${compactPreferredWidth}; --n_clearanceChatMin: ${minWidth}; --n_clearanceChatTarget: var(--n_chatPreferredW); }
@media (min-width: 64rem) {
#${gridRootFitId} { --n_chatDefaultW: ${defaultWidth}px; --n_chatPreferredW: ${preferredWidth}; }
}
@media (min-width: 40rem) {
@container navigation-chat-space (min-width: ${minWidth}) {
#${gridRootId} { --n_chatResponsiveTrack: min(100cqw, var(--n_cPnlRsz, var(--n_chatPreferredW))); }
#${gridRootId} [data-layout-chat-panel] {
grid-area: chat-panel;
width: min(100cqw, var(--n_cPnlRsz, var(--n_chatPreferredW)));
max-width: 100%;
z-index: auto;
background-color: ${"var(--ds-surface, #FFFFFF)"};
${hasBorder ? `box-shadow: initial; border-inline-start: ${"var(--ds-border-width, 1px)"} solid ${"var(--ds-border, #0B120E24)"};` : ''}
}
@media (prefers-reduced-motion: no-preference) {
#${gridRootId} [data-layout-chat-motion="entering"] { animation-name: var(--n-chat-inline-keyframe); }
}
}
}
`)
);
}