@hanzo/ui 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,13 +44,30 @@ const CtaBlockComponent: React.FC<BlockComponentProps & {
44
44
  }
45
45
 
46
46
  const mobile2Columns = containsToken(specifiers, 'mobile-2-columns')
47
+ // normally 'default' buttons have a min width only at > lg.
48
+ // generally if more than one we don't want this and override it,
49
+ // but this specifier asks to observe the default behavior.
50
+ const fillEvenly = !containsToken(specifiers, 'desktop-dont-fill')
47
51
  const mobileCenterFirstIfOdd = containsToken(specifiers, 'mobile-center-first-if-odd')
48
52
  const mobileOddFullWidth = containsToken(specifiers, 'mobile-odd-full-width')
49
53
 
50
- const layoutclx = (mobile2Columns && elements.length > 1) ?
51
- 'grid grid-cols-2 gap-2 self-stretch md:flex md:flex-sm md:justify-center '
52
- :
53
- 'flex flex-col items-stretch gap-2 self-stretch md:flex-row sm:justify-center '
54
+ let layoutclx: string | undefined = undefined
55
+ if (elements.length > 1) {
56
+ let resetMinWidth = false
57
+ if (mobile2Columns) {
58
+ layoutclx = 'grid grid-cols-2 gap-2 self-stretch '
59
+ resetMinWidth = true
60
+ }
61
+ if (fillEvenly) {
62
+ layoutclx = (layoutclx ?? 'grid grid-cols-2 gap-2 self-stretch')
63
+ resetMinWidth = true
64
+ }
65
+ else {
66
+ layoutclx = layoutclx ? (layoutclx + 'md:flex md:flex-row md:justify-center ') : 'flex flex-row justify-center '
67
+ }
68
+ itemclx += resetMinWidth ? '!min-w-0 ' : ''
69
+ }
70
+ layoutclx = layoutclx ?? 'flex flex-col items-stretch gap-2 self-stretch md:flex-row sm:justify-center '
54
71
 
55
72
  const getMobileColSpanClx = (index: number, total: number) => {
56
73
  const indexToCenter = (total % 2 === 0) ? -1 : (mobileCenterFirstIfOdd) ? 0 : total - 1
@@ -91,7 +91,7 @@ const Content: React.FC<{
91
91
  }) => {
92
92
 
93
93
 
94
- const layoutClx = 'flex flex-col gap-6 ' + ((agent !== 'phone') ? ('md:grid md:gap-8 ' + `md:grid-cols-${b.contentColumns.length} `) : '')
94
+ const layoutClx = 'flex flex-col gap-2 sm:gap-4 ' + ((agent !== 'phone') ? ('md:grid md:gap-8 ' + `md:grid-cols-${b.contentColumns.length} `) : '')
95
95
 
96
96
  const orderclx = (columnIndex: number): string => {
97
97
  const orderIndex = b.mobileOrder?.indexOf(columnIndex)
@@ -15,12 +15,14 @@ const ScreenfulComponent: React.FC<{
15
15
  initialInView?: boolean
16
16
  snapTile?: boolean
17
17
  className?: string
18
+ contentClx?: string
18
19
  }> = ({
19
20
  block,
20
21
  agent,
21
22
  initialInView=false,
22
23
  snapTile=false,
23
- className=''
24
+ className='',
25
+ contentClx=''
24
26
  }) => {
25
27
 
26
28
  if (block.blockType !== 'screenful') {
@@ -46,7 +48,7 @@ const ScreenfulComponent: React.FC<{
46
48
  // desktop header: 80px / pt-20
47
49
  // mobile header: 44px / pt-11
48
50
  narrowGutters ?
49
- 'px-6 lg:px-8 2xl:px-2 pb-6 pt-15 md:pt-26 lg:pt-28 '
51
+ 'px-6 lg:px-8 2xl:px-2 pb-6 ' + (snapTile ? 'pt-15 md:pt-26 lg:pt-28 ' : '') // otherwise assume there is a Main
50
52
  :
51
53
  'px-[8vw] xl:px-[1vw] pb-[8vh] pt-[calc(44px+4vh)] md:pt-[calc(80px+6vh)] ',
52
54
 
@@ -66,7 +68,7 @@ const ScreenfulComponent: React.FC<{
66
68
  initialInView={initialInView}
67
69
  />
68
70
  )}
69
- <div className={cn(...cwclx, snapTile ? 'absolute left-0 right-0 top-0 bottom-0' : 'flex min-h-screen w-full')} >
71
+ <div className={cn(...cwclx, snapTile ? 'absolute left-0 right-0 top-0 bottom-0' : 'flex min-h-screen w-full', contentClx)} >
70
72
  <Content block={b} agent={agent} className='w-full'/>
71
73
  {b.footer}
72
74
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/ui",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Library that contains shared UI primitives, support for a common design system, and other boilerplate support.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",