Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BpkCardList #3076

Draft
wants to merge 77 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
227a654
initial commit
Sep 27, 2023
ad2fd2b
progress
FireRedNinja Sep 27, 2023
2c66b82
progress
FireRedNinja Nov 8, 2023
62f6b2e
split types
Nov 8, 2023
b8689b0
Merge branch 'main' of github.com:Skyscanner/backpack into CardListCo…
Nov 8, 2023
74779e1
Merge branch 'main' into CardListComponentWeb
FireRedNinja Nov 16, 2023
39b3d31
fix grid and stack
FireRedNinja Nov 21, 2023
737a2b7
Merge branch 'main' of github.com:Skyscanner/backpack into CardListCo…
Nov 21, 2023
d1bd5b1
Merge branch 'CardListComponentWeb' of github.com:Skyscanner/backpack…
Nov 21, 2023
53c1248
BpkCardListRow v1
Nov 21, 2023
4b44d22
bare minimum of responsibe grid
FireRedNinja Nov 28, 2023
22cfbeb
move bpkcardlistgrid to new folder
FireRedNinja Nov 28, 2023
4af5213
added support for default items
FireRedNinja Nov 28, 2023
e1b7fe2
add typing for BpkCardListGrid
FireRedNinja Nov 28, 2023
d74517e
update CardList Row
Dec 7, 2023
3601917
Merge branch 'main' of github.com:Skyscanner/backpack into CardListCo…
Jan 12, 2024
a26a004
Merge branch 'main' of github.com:Skyscanner/backpack into CardListCo…
Jan 17, 2024
6c0a596
fix grid and stack
FireRedNinja Jan 18, 2024
beef2ee
Merge branch 'main' of github.com:Skyscanner/backpack into CardListCo…
Jan 19, 2024
000c35c
Merge branch 'CardListComponentWeb' of github.com:Skyscanner/backpack…
Jan 19, 2024
f920d99
Card List Rail
Jan 19, 2024
ab307af
demo
Jan 19, 2024
e2bf1e0
typing and cleanup
FireRedNinja Jan 19, 2024
2cfeaeb
add tests for grid, and expand components
FireRedNinja Jan 26, 2024
fb18876
Merge branch 'main' of github.com:Skyscanner/backpack into CardListCo…
Feb 1, 2024
57020f9
Row updates, additions to Storybook, and some tests
Feb 5, 2024
46d9e3f
added types for all components
FireRedNinja Feb 9, 2024
85b7c4f
types are working, still needs cleanup
FireRedNinja Feb 12, 2024
c6c461f
added tests for bpkcardlist
FireRedNinja Feb 12, 2024
8c2f3a6
BpkCardListRow test and updates
Mar 4, 2024
c161b63
accessibility tests
Mar 4, 2024
e71bd7a
Merge branch 'main' of github.com:Skyscanner/backpack into CardListCo…
Mar 4, 2024
0053be7
update storybook examples
FireRedNinja Mar 6, 2024
cb9123b
simplify types
FireRedNinja Mar 11, 2024
0bd982f
add href to button
FireRedNinja Mar 11, 2024
84a6faf
fix typing issues
FireRedNinja Mar 11, 2024
d380d62
update node-sass imports to sass
FireRedNinja Mar 11, 2024
7d55a98
update node-sass imports to sass
FireRedNinja Mar 11, 2024
4bfd247
fix build issues
FireRedNinja Mar 11, 2024
9e84cac
fix tests
FireRedNinja Mar 14, 2024
01be924
add licencing
FireRedNinja Mar 14, 2024
8acba41
fix tokens without proper reference to modules
FireRedNinja Mar 14, 2024
27822e3
empty commit
FireRedNinja Mar 14, 2024
da915a6
build
FireRedNinja Mar 14, 2024
7c2f729
documentation and style fix
Mar 18, 2024
9522da6
a11y props for pageIndicator
May 1, 2024
278dfbf
Merge branch 'main' of github.com:Skyscanner/backpack into CardListCo…
May 1, 2024
6dcb7ad
lint
May 1, 2024
792a3f9
remove comment
FireRedNinja May 2, 2024
0c33390
type fix
FireRedNinja May 8, 2024
cb97b48
lint and VR tests
May 9, 2024
0efd0b4
update to SectionHeader snaps
May 9, 2024
6d603ef
Merge branch 'main' of github.com:Skyscanner/backpack into CardListCo…
May 9, 2024
3c971d1
update d.ts file
FireRedNinja May 8, 2024
6eaf58d
Merge branch 'main' into CardListComponentWeb
FireRedNinja May 22, 2024
05f167c
update snaps
May 22, 2024
40bbaed
Merge branch 'main' into CardListComponentWeb
FireRedNinja May 30, 2024
5173e06
fix padding
FireRedNinja Jun 3, 2024
34048b0
fix padding for mobilescrollcontainer
FireRedNinja Jun 7, 2024
0ed0db7
Merge branch 'main' of https://github.com/Skyscanner/backpack into Ca…
Jun 16, 2024
abe65fe
update rail card width
Jun 17, 2024
83d4e80
remove max items restriction on row and rail
FireRedNinja Jun 28, 2024
cb4df8d
remove unused code
FireRedNinja Jul 2, 2024
04d97f4
Merge branch 'main' into CardListComponentWeb
FireRedNinja Jul 2, 2024
f1dac4d
typecheck fix
FireRedNinja Jul 2, 2024
5c29315
update snapshots
FireRedNinja Jul 2, 2024
ff71e0a
Merge branch 'main' into CardListComponentWeb
olliecurtis Jul 9, 2024
1238a16
padding variants for Row when there are different numbers of cards shown
Jul 22, 2024
5f1ad0f
Merge branch 'main' of github.com:Skyscanner/backpack into CardListCo…
Jul 22, 2024
2a13959
mockCards rewrite
FireRedNinja Jul 23, 2024
2ad6f57
generate new module
Jul 23, 2024
11b1a53
fix tests
FireRedNinja Jul 23, 2024
6f68c4b
Merge branch 'main' into CardListComponentWeb
FireRedNinja Jul 23, 2024
47c29aa
addressing comments
FireRedNinja Jul 25, 2024
5e83e16
remove autogenerated files
FireRedNinja Jul 25, 2024
a35d91e
address comments
Aug 6, 2024
5006ce4
Merge branch 'main' of github.com:Skyscanner/backpack into CardListCo…
Aug 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ To contribute please see [contributing.md](CONTRIBUTING.md).
[`bpk-component-button`](/packages/bpk-component-button)
[`bpk-component-calendar`](/packages/bpk-component-calendar)
[`bpk-component-card`](/packages/bpk-component-card)
[`bpk-component-card-list`](/packages/bpk-component-card-list)
[`bpk-component-checkbox`](/packages/bpk-component-checkbox)
[`bpk-component-chip`](/packages/bpk-component-chip)
[`bpk-component-chip-group`](/packages/bpk-component-chip-group)
Expand Down
200 changes: 200 additions & 0 deletions examples/bpk-component-card-list/examples.js
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
/*
* Backpack - Skyscanner's Design System
*
* Copyright 2016 Skyscanner Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* @flow strict */

import { useState } from 'react';

import BpkCard from '../../packages/bpk-component-card';
import BpkCardList from '../../packages/bpk-component-card-list';
import BpkImage from '../../packages/bpk-component-image';
import BpkLink from '../../packages/bpk-component-link';
import BpkText, { TEXT_STYLES } from '../../packages/bpk-component-text';

import STYLES from './examples.module.scss';

const DealsCard = (i) => (
<BpkCard atomic={false} onClick={() => null}>
<BpkText
tagName="h3"
textStyle={TEXT_STYLES.heading5}
style={{ marginBottom: '8px' }}
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
>
{`Let's explore Deal ${i}`}
</BpkText>
<BpkText tagName="p">
{`It's your world and we'll help you explore it. Find the best prices across millions of flights, hotels and car hire options to create your perfect trip.`}
<br />
</BpkText>
</BpkCard>
);
const DestinationCard = (i) => (
<BpkCard href="/" className={STYLES['bpk-destinationCard']} padded={false}>
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
<BpkImage
aspectRatio={3000 / 1800}
className={STYLES['bpk-destinationCard-image']}
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
src="https://content.skyscnr.com/7adba3a46af3ca29695f96937d19fcf1/GettyImages-149127892.jpg?crop=960px:640px&quality=100"
/>

<div className={STYLES['bpk-bottom']}>
<div className={STYLES['bpk-column']}>
<BpkText textStyle={TEXT_STYLES.heading4}>
{`Destination Name ${i}`}
</BpkText>
<BpkText>Country</BpkText>
</div>

<div className={STYLES['bpk-column']}>
<BpkText>Direct</BpkText>
<BpkText textStyle={TEXT_STYLES.heading4}>£100</BpkText>
</div>
</div>
</BpkCard>
);
const InternalLinkCard = (i) => (
<BpkCard href="/" className={STYLES['bpk-internalLinkCard']} padded={false}>
<BpkImage
className={STYLES['bpk-image']}
aspectRatio={1000 / 1000}
src="https://content.skyscnr.com/fa0912c6ed6f75f0607dfc080359a021/amsterdam.jpg?crop=100px:100px&quality=90"
/>

<div className={STYLES['bpk-info']}>
<BpkText
textStyle={TEXT_STYLES.heading5}
>{`Amsterdam Schiphol ${i}`}</BpkText>

<div className={STYLES['bpk-verticalLinks']}>
<BpkLink href="#">Flights</BpkLink>
<span aria-hidden className={STYLES['bpk-verticalLinks_bullet']}>
{'\u2022'}
</span>
<BpkLink href="#">Hotels</BpkLink>
<span aria-hidden className={STYLES['bpk-verticalLinks_bullet']}>
{'\u2022'}
</span>
<BpkLink href="#">Car Hire</BpkLink>
</div>
</div>
</BpkCard>
);
const cards = (cardType) => [...Array(14).keys()].map((i) => cardType(i));

const title = 'Must-visit spots';
const description =
'Check out these world-famous destinations perfect for visiting in spring.';

const GridToRailExample = () => {
const [collapsed, setCollapsed] = useState(true);
const expandText = 'Show More';
const collapseText = 'Show Less';

const onButtonClick = () => {
setCollapsed(!collapsed);
};

return (
<BpkCardList
cardList={cards(InternalLinkCard)}
accessory="expand"
layoutDesktop="grid"
layoutMobile="rail"
title={title}
onButtonClick={onButtonClick}
description={description}
expandText={collapsed ? expandText : collapseText}
/>
);
};

const GridToStackExample = () => {
const [collapsed, setCollapsed] = useState(true);
const expandText = 'Show More';
const collapseText = 'Show Less';

const onButtonClick = () => {
setCollapsed(!collapsed);
};

return (
<BpkCardList
cardList={cards(DealsCard)}
accessory="expand"
layoutDesktop="grid"
layoutMobile="stack"
title={title}
description={description}
initiallyShownCards={4}
expandText={collapsed ? expandText : collapseText}
onButtonClick={onButtonClick}
/>
);
};

const GridToStackWithButtonExample = () => (
<BpkCardList
cardList={cards(DestinationCard)}
accessory="button"
layoutDesktop="grid"
layoutMobile="stack"
title={title}
description={description}
buttonText="Explore More"
/>
);

const RowToRailWith4InitiallyShownCardsExmaple = () => (
<BpkCardList
cardList={cards(DealsCard)}
accessory="pagination"
layoutDesktop="row"
layoutMobile="rail"
title={title}
description={description}
initiallyShownCards={4}
buttonText="Explore more"
/>
);
const RowToRailExample = () => (
<BpkCardList
cardList={cards(DealsCard)}
accessory="pagination"
layoutDesktop="row"
layoutMobile="rail"
title={title}
description={description}
/>
);
const RowToStackExample = () => (
<BpkCardList
cardList={cards(DestinationCard)}
accessory="pagination"
layoutDesktop="row"
layoutMobile="stack"
title={title}
description={description}
/>
);

export {
RowToRailExample,
RowToRailWith4InitiallyShownCardsExmaple,
GridToRailExample,
GridToStackWithButtonExample,
RowToStackExample,
GridToStackExample,
};
18 changes: 18 additions & 0 deletions examples/bpk-component-card-list/examples.module.css
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Backpack - Skyscanner's Design System
*
* Copyright 2016 Skyscanner Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-card-list-examples__header{display:flex;height:2.5rem;padding:.5rem;justify-content:space-between;align-items:center;color:#fff}.bpk-card-list-examples__wrapper{width:20.5rem}.bpk-destinationCard .bpk-destinationCard-image{border-top-left-radius:.75rem;border-top-right-radius:.75rem;overflow:hidden}.bpk-destinationCard .bpk-bottom{display:flex;padding:1.5rem;justify-content:space-between}.bpk-destinationCard .bpk-column{display:flex;flex-direction:column}.bpk-internalLinkCard{display:flex;overflow:hidden}.bpk-internalLinkCard .bpk-image{flex:0 0 5.5rem}.bpk-internalLinkCard .bpk-info{display:flex;margin:auto 1.5rem;flex-direction:column}.bpk-internalLinkCard .bpk-verticalLinks_bullet{margin:0 .25rem;color:#0062e3}
75 changes: 75 additions & 0 deletions examples/bpk-component-card-list/examples.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Backpack - Skyscanner's Design System
*
* Copyright 2016 Skyscanner Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@import '../../packages/bpk-mixins/index.scss';
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved

.bpk-card-list-examples {
&__header {
display: flex;
height: bpk-spacing-xxl();
padding: bpk-spacing-md();
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
justify-content: space-between;
align-items: center;
color: $bpk-text-on-dark-day;
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
}

&__wrapper {
width: bpk-spacing-md() * 41;
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
}
}

.bpk-destinationCard {
.bpk-destinationCard-image {
border-top-left-radius: 0.75rem;
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
border-top-right-radius: 0.75rem;
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
overflow: hidden;
}

.bpk-bottom {
display: flex;
padding: bpk-spacing-lg();
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
justify-content: space-between;
}

.bpk-column {
display: flex;
flex-direction: column;
}
}

.bpk-internalLinkCard {
display: flex;
overflow: hidden;

.bpk-image {
flex: 0 0 5.5rem;
}

.bpk-info {
display: flex;
margin: auto bpk-spacing-lg();
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
flex-direction: column;
}

.bpk-verticalLinks {
&_bullet {
margin: 0 bpk-spacing-sm();
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
color: $bpk-core-accent-day;
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
54 changes: 54 additions & 0 deletions examples/bpk-component-card-list/stories.js
youngji0827 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Backpack - Skyscanner's Design System
*
* Copyright 2016 Skyscanner Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import BpkCardList from '../../packages/bpk-component-card-list/src/BpkCardList';

import {
GridToRailExample,
GridToStackExample,
GridToStackWithButtonExample,
RowToRailExample,
RowToRailWith4InitiallyShownCardsExmaple,
RowToStackExample,
} from './examples';

export default {
title: 'bpk-component-card-list',
component: BpkCardList,
};

export const GridToRail = GridToRailExample;
export const GridToStack = GridToStackExample;
export const GridToStackWithButton = GridToStackWithButtonExample;
export const RowToRail = RowToRailExample;
export const RowToRailWithHeaderButton =
RowToRailWith4InitiallyShownCardsExmaple;
export const RowToStack = RowToStackExample;

export const VisualTest = GridToRail;
export const VisualTestVariant = RowToStack;

export const VisualTestWithZoom = VisualTest.bind({});
VisualTestWithZoom.args = {
zoomEnabled: true,
};

export const VisualTestVariantWithZoom = VisualTestVariant.bind({});
VisualTestVariantWithZoom.args = {
zoomEnabled: true,
};
Loading
Loading