Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5163905
add Grid and Flex
kerrie-wu Dec 8, 2025
6e8702b
add BpkStack
IrinaWei Dec 9, 2025
e510829
update
kerrie-wu Dec 9, 2025
65eabec
add GridItem
kerrie-wu Dec 9, 2025
66b9dff
add BpkStack-test and change Stories
IrinaWei Dec 9, 2025
bd03afe
change bpkStack test
IrinaWei Dec 9, 2025
c5d409c
add flex props
IrinaWei Dec 9, 2025
d4c6fa2
responsive
kerrie-wu Dec 11, 2025
048797e
fix test issue
kerrie-wu Dec 11, 2025
f800829
feat(layout): add css-var shell and wrappers
Faye-Xiao Dec 11, 2025
035de97
add Grid responsive example
kerrie-wu Dec 12, 2025
ca9ec61
responsive
kerrie-wu Dec 12, 2025
5a43022
Merge branch 'bpk-layout-PoC' into clov-987
Faye-Xiao Dec 12, 2025
aa96e83
add semicolumn and add more descriptions to Stack examples
IrinaWei Dec 12, 2025
8678bb2
split story book
kerrie-wu Dec 12, 2025
3711d32
wrap props responsive
kerrie-wu Dec 12, 2025
4107507
change lint and main.ts
IrinaWei Dec 12, 2025
08cfd2c
merge code from CLOV-989
Faye-Xiao Dec 12, 2025
16383be
Merge branch 'CLOV-989' into CLOV-990
Faye-Xiao Dec 12, 2025
78a09fa
merge code from clov-987
Faye-Xiao Dec 12, 2025
7a1ee16
feat(layout): apply hybrid shell to flex/grid/stack
Faye-Xiao Dec 14, 2025
5e5c468
perf(layout): add Storybook benchmarks + autorun JSONL export
Faye-Xiao Dec 14, 2025
4160749
fix(perf): align perf SCSS tokens/mixins with bpk-mixins
Faye-Xiao Dec 14, 2025
7eae43f
perf(layout): make benchmark stories responsive by default
Faye-Xiao Dec 14, 2025
e4490e1
add test result
Faye-Xiao Dec 14, 2025
71ce3d0
docs(perf): add comparison report for layout benchmark results
Faye-Xiao Dec 14, 2025
5f4ee0d
docs(perf): add decision summary for layout PoC
Faye-Xiao Dec 14, 2025
54bf0f7
docs(perf): explain metric and percentile columns in test README
Faye-Xiao Dec 14, 2025
8c989c8
docs(perf): add benchmark intent to datasets section
Faye-Xiao Dec 14, 2025
e41c574
remove unused doc
Faye-Xiao Dec 14, 2025
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
2 changes: 1 addition & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type { StorybookConfig } from '@storybook/react-webpack5';

const config: StorybookConfig = {
stories: [
'../examples/**/stories.@(ts|tsx|js|jsx)',
'../examples/**/{stories,*.stories}.@(ts|tsx|js|jsx)',
],
addons: [
'@storybook/addon-a11y',
Expand Down
12 changes: 11 additions & 1 deletion .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ const rootDir = path.resolve(__dirname, '../');
const devMode = process.env.NODE_ENV !== "production";

module.exports = ({ config }) => {
// Remove existing css/scss rules to avoid double-processing with Storybook defaults.
config.module.rules = config.module.rules.filter(
(rule) => {
const testStr = rule.test ? rule.test.toString() : '';
return !(testStr.includes('\\.css') || testStr.includes('\\.scss'));
},
);

config.plugins.push(new MiniCssExtractPlugin());
config.module.rules.push({
test: /\.[jt]sx?$/,
Expand Down Expand Up @@ -61,7 +69,7 @@ module.exports = ({ config }) => {
},
});
config.module.rules.push({
test: /\.css/,
test: /\.css$/,
use: [
{
loader: devMode ? "style-loader" : MiniCssExtractPlugin.loader,
Expand All @@ -71,6 +79,7 @@ module.exports = ({ config }) => {
options: {
importLoaders: 1,
modules: {
auto: /\.module\.css$/,
localIdentName: '[local]-[hash:base64:5]',
namedExport: false,
exportLocalsConvention: 'as-is',
Expand Down Expand Up @@ -98,6 +107,7 @@ module.exports = ({ config }) => {
options: {
importLoaders: 1,
modules: {
auto: /\.module\.(scss|sass)$/,
localIdentName: '[local]-[hash:base64:5]',
namedExport: false,
exportLocalsConvention: 'as-is',
Expand Down
5 changes: 5 additions & 0 deletions @types/scss.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ declare module '*.scss' {
declare const styles: { [className: string]: string };
export default styles;
}

declare module '*.css' {
const content: string;
export default content;
}
170 changes: 170 additions & 0 deletions examples/bpk-component-layout/flex-examples.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
/*
* 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 {
BpkBox,
BpkFlex,
BpkSpacing,
} from '../../packages/bpk-component-layout';

import { Wrapper } from './examples';

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

export const BpkFlexExample = () => (
<Wrapper>
<BpkFlex
direction="row"
justify="space-between"
align="center"
padding={BpkSpacing.MD}
>
{[1, 2, 3].map((i) => (
<BpkBox key={i} padding={BpkSpacing.SM}>
<span className={STYLES['bpk-layout-examples__outline']}>
Flex item {i}
</span>
</BpkBox>
))}
</BpkFlex>
</Wrapper>
);

export const BpkFlexDirectionExample = () => (
<Wrapper>
<BpkFlex direction="column" gap={BpkSpacing.MD} padding={BpkSpacing.MD}>
<BpkBox padding={BpkSpacing.SM}>
<span className={STYLES['bpk-layout-examples__outline']}>
Column item 1
</span>
</BpkBox>
<BpkBox padding={BpkSpacing.SM}>
<span className={STYLES['bpk-layout-examples__outline']}>
Column item 2
</span>
</BpkBox>
</BpkFlex>
</Wrapper>
);

export const BpkFlexWrapExample = () => (
<Wrapper>
<BpkFlex
wrap="wrap"
gap={BpkSpacing.MD}
padding={BpkSpacing.MD}
width="100%"
>
{[1, 2, 3, 4, 5, 6].map((i) => (
<BpkBox key={i} padding={BpkSpacing.MD} width="10rem">
<span className={STYLES['bpk-layout-examples__outline']}>
Wrap Item {i}
</span>
</BpkBox>
))}
</BpkFlex>
</Wrapper>
);

export const BpkFlexResponsiveExample = () => (
<Wrapper>
<BpkFlex
direction={{ mobile: 'column', tablet: 'row' }}
justify={{ mobile: 'flex-start', desktop: 'space-between' }}
gap={BpkSpacing.MD}
padding={BpkSpacing.MD}
>
{[1, 2, 3].map((i) => (
<BpkBox key={i} padding={BpkSpacing.SM}>
<span className={STYLES['bpk-layout-examples__outline']}>
Responsive Item {i}
</span>
</BpkBox>
))}
</BpkFlex>
</Wrapper>
);

export const BpkFlexItemExample = () => (
<Wrapper>
<BpkFlex gap={BpkSpacing.MD} padding={BpkSpacing.MD} width="100%">
<BpkFlex
grow={1}
padding={BpkSpacing.MD}
justify="center"
align="center"
>
<BpkBox padding={BpkSpacing.SM} width="100%">
<span className={STYLES['bpk-layout-examples__outline']}>
Grow: 1
</span>
</BpkBox>
</BpkFlex>
<BpkFlex
grow={2}
padding={BpkSpacing.MD}
justify="center"
align="center"
>
<BpkBox padding={BpkSpacing.SM} width="100%">
<span className={STYLES['bpk-layout-examples__outline']}>
Grow: 2
</span>
</BpkBox>
</BpkFlex>
<BpkFlex
basis="12.5rem"
shrink={0}
padding={BpkSpacing.MD}
justify="center"
align="center"
>
<BpkBox padding={BpkSpacing.SM} width="100%">
<span className={STYLES['bpk-layout-examples__outline']}>
Basis: 200px, Shrink: 0
</span>
</BpkBox>
</BpkFlex>
</BpkFlex>
</Wrapper>
);

export const BpkFlexInlineExample = () => (
<Wrapper>
<BpkBox padding={BpkSpacing.MD}>
<BpkFlex
inline
gap={BpkSpacing.SM}
padding={BpkSpacing.SM}
>
<BpkBox padding={BpkSpacing.SM}>
<span className={STYLES['bpk-layout-examples__outline']}>
Inline Flex 1
</span>
</BpkBox>
<BpkBox padding={BpkSpacing.SM}>
<span className={STYLES['bpk-layout-examples__outline']}>
Inline Flex 2
</span>
</BpkBox>
</BpkFlex>
{' '}
<span>Text adjacent to inline flex</span>
</BpkBox>
</Wrapper>
);
47 changes: 47 additions & 0 deletions examples/bpk-component-layout/flex.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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 { BpkFlex, BpkProvider } from '../../packages/bpk-component-layout';

import {
BpkFlexExample,
BpkFlexDirectionExample,
BpkFlexWrapExample,
BpkFlexResponsiveExample,
BpkFlexItemExample,
BpkFlexInlineExample,
} from './flex-examples';

export default {
title: 'bpk-component-layout/Flex',
component: BpkFlex,
decorators: [
(Story: any) => (
<BpkProvider>
<Story />
</BpkProvider>
),
],
};

export const Default = BpkFlexExample;
export const Direction = BpkFlexDirectionExample;
export const Wrap = BpkFlexWrapExample;
export const Responsive = BpkFlexResponsiveExample;
export const ItemProps = BpkFlexItemExample;
export const Inline = BpkFlexInlineExample;
Loading
Loading