Skip to content

Commit

Permalink
actually fix view-height
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Oct 1, 2024
1 parent e0f08ca commit 08c4c1b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
6 changes: 4 additions & 2 deletions standard/packages/core/src/component/CalendarContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ export class CalendarContent extends PureComponent<CalendarContentProps> {
)

let viewHeight: CssDimValue | undefined
let viewHeightLiquid = false
let viewAspectRatio: number | undefined

if (props.forPrint || getIsHeightAuto(options)) {
; // don't set any heights
;
} else if (options.height != null) {
; // nothing to do. already set via Calendar::setHeight
viewHeightLiquid = true
} else if (options.contentHeight != null) {
viewHeight = options.contentHeight
} else {
Expand Down Expand Up @@ -92,6 +93,7 @@ export class CalendarContent extends PureComponent<CalendarContentProps> {
)}
<ViewHarness
height={viewHeight}
heightLiquid={viewHeightLiquid}
aspectRatio={viewAspectRatio}
>
{this.renderView(props)}
Expand Down
20 changes: 10 additions & 10 deletions standard/packages/core/src/component/ViewHarness.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ import { CssDimValue } from '../scrollgrid/util.js'

export interface ViewHarnessProps {
height?: CssDimValue
heightLiquid?: boolean
aspectRatio?: number
children: ComponentChildren
}

export class ViewHarness extends Component<ViewHarnessProps> {
render() {
const { props } = this
const { height, aspectRatio } = props
const fixedHeightEnabled = height != null
const aspectRatioEnabled = !fixedHeightEnabled && aspectRatio != null

return (
<div
className={[
'fc-view-harness',
fixedHeightEnabled
props.height != null
? 'fc-view-harness-fixedheight'
: aspectRatioEnabled
? 'fc-view-harness-aspectratio'
: 'fc-view-harness-liquid',
: props.heightLiquid
? 'fc-view-harness-liquid'
: props.aspectRatio != null
? 'fc-view-harness-aspectratio'
: ''
].join(' ')}
style={{
height,
paddingBottom: aspectRatioEnabled
? `${(1 / aspectRatio) * 100}%`
height: props.height,
paddingBottom: props.aspectRatio != null
? `${(1 / props.aspectRatio) * 100}%`
: undefined
}}
>
Expand Down
16 changes: 3 additions & 13 deletions standard/packages/core/src/styles/view-harness.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
position: relative; // for aspectratio AND for being origin for premium-message at bottom-left corner
}

.fc-view-harness-liquid,
.fc-view-harness-fixedheight {
display: flex;
flex-direction: column;
}

.fc-view-harness-liquid,
.fc-view-harness-liquid > .fc-view,
.fc-view-harness-fixedheight > .fc-view {
// liquid
flex-basis: 0;
Expand All @@ -22,16 +25,3 @@
right: 0;
bottom: 0;
}

.fc-view-harness-liquid {
display: flex;
flex-direction: column;
}

.fc-view-harness-liquid,
.fc-view-harness-liquid > .fc-view {
// liquid
flex-grow: 1;
flex-basis: 0;
min-height: 0;
}

0 comments on commit 08c4c1b

Please sign in to comment.