Skip to content

Commit e33ef26

Browse files
Making WaterFall cards have max height of 600px (#2770)
* trying to add max height to waterfall * making max-height of waterfall card 100% instead of static value and fixing content section height * removing extra estimated size set * replacing max-height with block-height and removing extra one * removing defunct elements from card chromatic story * addressing review comment Co-authored-by: Robert Snow <[email protected]>
1 parent 64dd370 commit e33ef26

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

packages/@adobe/spectrum-css-temp/components/card/index.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,10 @@ user-provided
224224
}
225225

226226
.spectrum-Card-grid {
227+
block-size: 100%;
227228
display: grid;
228229
grid-template-columns: var(--spectrum-card-body-padding-left) minmax(0, auto) minmax(var(--spectrum-global-dimension-size-500), 1fr) minmax(0, auto) var(--spectrum-card-body-padding-right);
229-
grid-template-rows: minmax(var(--spectrum-card-coverphoto-height), auto) var(--spectrum-global-dimension-size-300) minmax(var(--spectrum-actionbutton-height), auto) 1fr var(--spectrum-card-body-padding-bottom);
230+
grid-template-rows: minmax(var(--spectrum-card-coverphoto-height), 1fr) var(--spectrum-global-dimension-size-300) minmax(var(--spectrum-actionbutton-height), auto) auto var(--spectrum-card-body-padding-bottom);
230231
/* absolutely position avatar relative to the preview */
231232
grid-template-areas:
232233
"preview preview preview preview preview"
@@ -566,7 +567,7 @@ user-provided
566567
block-size: 100%;
567568
display: grid;
568569
grid-template-columns: minmax(0, auto) minmax(var(--spectrum-global-dimension-size-500), 1fr) minmax(0, auto);
569-
grid-template-rows: minmax(var(--spectrum-card-coverphoto-height), auto) var(--spectrum-card-quiet-body-header-margin-top) minmax(var(--spectrum-actionbutton-height), auto) 1fr;
570+
grid-template-rows: minmax(var(--spectrum-card-coverphoto-height), 1fr) var(--spectrum-card-quiet-body-header-margin-top) minmax(var(--spectrum-actionbutton-height), auto) auto;
570571
grid-template-areas:
571572
"preview preview preview"
572573
". . . "

packages/@react-spectrum/card/chromatic/CardView.chromatic.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
import {ActionMenu, Item} from '@react-spectrum/menu';
14-
import {Button} from '@react-spectrum/button';
1513
import {Card, CardView, GalleryLayout, GridLayout, WaterfallLayout} from '..';
16-
import {Content, Footer} from '@react-spectrum/view';
14+
import {Content} from '@react-spectrum/view';
1715
import {Heading, Text} from '@react-spectrum/text';
1816
import {Image} from '@react-spectrum/image';
1917
import {Meta, Story} from '@storybook/react';
@@ -68,13 +66,6 @@ function DynamicCardView(props: SpectrumCardViewProps<object>) {
6866
<Heading>{item.title}</Heading>
6967
<Text slot="detail">PNG</Text>
7068
<Content>Description</Content>
71-
<ActionMenu>
72-
<Item>Action 1</Item>
73-
<Item>Action 2</Item>
74-
</ActionMenu>
75-
<Footer>
76-
<Button variant="primary">Something</Button>
77-
</Footer>
7869
</Card>
7970
)}
8071
</CardView>

packages/@react-spectrum/card/src/WaterfallLayout.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,9 @@ export class WaterfallLayout<T> extends BaseLayout<T> implements KeyboardDelegat
172172
// TODO: also not sure about copying layout info vs mutating it. Listlayout does the below
173173
// but I feel that is because it actually maintained a layoutNode map cache which this doesn't have
174174
let newLayoutInfo = layoutInfo.copy();
175-
newLayoutInfo.rect.height = size.height;
175+
newLayoutInfo.rect.height = size.height < 600 ? size.height : 600;
176+
newLayoutInfo.estimatedSize = false;
176177
this.layoutInfos.set(key, newLayoutInfo);
177-
// TODO: v2 had layoutInfo.estimatedSize = view.estimatedSize || false; but we can't do the same here?
178-
layoutInfo.estimatedSize = false;
179178
return true;
180179
}
181180

0 commit comments

Comments
 (0)