1- import { type ClassValue , tcls } from '@/lib/tailwind' ;
2- import type { DocumentBlockColumns , Length } from '@gitbook/api' ;
1+ import { tcls } from '@/lib/tailwind' ;
2+ import { type DocumentBlockColumns , type Length , VerticalAlignment } from '@gitbook/api' ;
33import type { BlockProps } from '../Block' ;
44import { Blocks } from '../Blocks' ;
55
@@ -8,10 +8,12 @@ export function Columns(props: BlockProps<DocumentBlockColumns>) {
88 return (
99 < div className = { tcls ( 'flex flex-col gap-x-8 md:flex-row' , style ) } >
1010 { block . nodes . map ( ( columnBlock ) => {
11- const width = columnBlock . data . width ;
12- const { className, style } = transformLengthToCSS ( width ) ;
1311 return (
14- < Column key = { columnBlock . key } className = { className } style = { style } >
12+ < Column
13+ key = { columnBlock . key }
14+ width = { columnBlock . data . width }
15+ verticalAlignment = { columnBlock . data . verticalAlignment }
16+ >
1517 < Blocks
1618 key = { columnBlock . key }
1719 nodes = { columnBlock . nodes }
@@ -29,11 +31,23 @@ export function Columns(props: BlockProps<DocumentBlockColumns>) {
2931
3032export function Column ( props : {
3133 children ?: React . ReactNode ;
32- className ?: ClassValue ;
33- style ?: React . CSSProperties ;
34+ width ?: Length ;
35+ verticalAlignment ?: VerticalAlignment ;
3436} ) {
37+ const { width, verticalAlignment } = props ;
38+ const { className, style } = transformLengthToCSS ( width ) ;
3539 return (
36- < div className = { tcls ( 'flex-col' , props . className ) } style = { props . style } >
40+ < div
41+ className = { tcls (
42+ 'flex flex-col' ,
43+ ( verticalAlignment === VerticalAlignment . Top || ! verticalAlignment ) &&
44+ 'justify-start' ,
45+ verticalAlignment === VerticalAlignment . Middle && 'justify-center' ,
46+ verticalAlignment === VerticalAlignment . Bottom && 'justify-end' ,
47+ className
48+ ) }
49+ style = { style }
50+ >
3751 { props . children }
3852 </ div >
3953 ) ;
0 commit comments