Skip to content

feat: add first time orientation pattern using interstitialScreen #615

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

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
111e4d6
feat: add first time orientation pattern using interstitial test
amal-k-joy May 27, 2025
400a0e6
feat: add first time orientation pattern and its example usage
amal-k-joy May 28, 2025
043de52
feat: update yarn.lock
amal-k-joy May 28, 2025
c4f0f80
fix: lint and format
amal-k-joy May 28, 2025
bc8146a
fix: corect example
amal-k-joy May 28, 2025
100799f
fix: update docs
amal-k-joy May 28, 2025
57d0645
fix: build
amal-k-joy May 28, 2025
ab9846d
fix: license and doc update
amal-k-joy May 29, 2025
754dead
Merge branch 'main' into interstitialPattern
amal-k-joy Jun 3, 2025
255f08c
Update packages/react/src/components/WhatsNew/__stories__/FirstTimeOr…
amal-k-joy Jun 10, 2025
a262be5
Update packages/react/src/components/WhatsNew/__stories__/WhatsNew.mdx
amal-k-joy Jun 10, 2025
a6e084b
Update packages/react/src/components/WhatsNew/__stories__/WhatsNew.mdx
amal-k-joy Jun 10, 2025
36c20d1
fix: move firstTimeOrientation to patterns main level
amal-k-joy Jun 10, 2025
1317932
fix: yarn install
amal-k-joy Jun 10, 2025
30bce45
fix: yarn resolve conflicts
amal-k-joy Jun 10, 2025
5ec5b32
fix: yarn install 2
amal-k-joy Jun 10, 2025
bb7a415
fix: add index.ts file
amal-k-joy Jun 10, 2025
2f07b42
fix: build issue
amal-k-joy Jun 11, 2025
2b174ed
fix: build issue 2
amal-k-joy Jun 11, 2025
94ecb99
fix: remove old files
amal-k-joy Jun 11, 2025
3766ce1
fix: build issue 3
amal-k-joy Jun 11, 2025
6c335de
fix: build issue 4
amal-k-joy Jun 11, 2025
c26eecb
fix: build issue 5
amal-k-joy Jun 11, 2025
4cb9c41
fix: lint fix
amal-k-joy Jun 11, 2025
b63763a
Update packages/react/src/components/FirstTimeOrientation/__stories__…
amal-k-joy Jun 16, 2025
be71888
Update packages/react/src/components/FirstTimeOrientation/__stories__…
amal-k-joy Jun 16, 2025
b444c99
Update examples/react/FirstTimeOrientation/src/components/Personaliza…
amal-k-joy Jun 16, 2025
0db7ef2
fix: remove story duplication
amal-k-joy Jun 16, 2025
e7d1a94
fix: review comment to restore @carbon/ibm-products version
amal-k-joy Jun 17, 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
22 changes: 22 additions & 0 deletions examples/react/FirstTimeOrientation/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
@license

Copyright IBM Corp. 2025

This source code is licensed under the Apache-2.0 license found in the
LICENSE file in the root directory of this source tree.
-->

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>interstitial screen pattern example</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
28 changes: 28 additions & 0 deletions examples/react/FirstTimeOrientation/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "carbon-labs-react-firt-time-orientation-example",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@carbon/ibm-products": "^2.65.0",
"@carbon/react": "^1.78.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@carbon-labs/react-text-highlighter": "latest",
"@carbon-labs/utilities": "canary",
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react": "^4.2.1",
"sass": "~1.83.0",
"typescript": "^5.2.2",
"vite": "^5.0.8"
}
}
63 changes: 63 additions & 0 deletions examples/react/FirstTimeOrientation/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React, { useState } from 'react';
import { InterstitialScreen, pkg } from '@carbon/ibm-products';
import { Button } from '@carbon/react';
import { ContentWrapper } from './components/ContentWrapper';
import { PersonalizationInterstitial, WelcomeInterstitial } from './components';

function App() {
const [showInterstitialModal, setShowInterstitialModal] = useState(true);

const defaultProps = {
headerTitle: 'Welcome to your sandbox, Jack!',
interstitialAriaLabel: 'Interstitial Screen',
};

pkg.component.InterstitialScreen = true;

return (
<>
<Button
onClick={() => {
setShowInterstitialModal(true);
}}>
Show Interstitial modal
</Button>
<InterstitialScreen
isOpen={showInterstitialModal}
onClose={() => {
setShowInterstitialModal(false);
}}
interstitialAriaLabel={defaultProps.interstitialAriaLabel}
isFullScreen={false}>
<InterstitialScreen.Header
headerTitle={defaultProps.headerTitle}></InterstitialScreen.Header>
<InterstitialScreen.Body
contentRenderer={() => {
return (
<>
<ContentWrapper stepTitle="Welcome">
<WelcomeInterstitial />
</ContentWrapper>
<ContentWrapper stepTitle="Tailor your experience">
<PersonalizationInterstitial />
</ContentWrapper>
</>
);
}}
/>
<InterstitialScreen.Footer />
</InterstitialScreen>
</>
);
}

export default App;
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Copyright IBM Corp. 2023, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

// Import portions of React that are needed.
import React, { PropsWithChildren, ReactNode } from 'react';

interface ContentWrapperProps extends PropsWithChildren {
/**
* Provide the contents of the InterstitialScreenView.
*/
children?: ReactNode;

/**
* Optional class name for this component.
*/
className?: string;

/**
* The label to pass to the ProgressStep component.
*/
stepTitle: string;

/**
* Optional method that takes in a message id and returns an internationalized string.
*/
translateWithId?: (id: string) => string;
}
/**
* An Onboarding component intended to be used as the child elements of the InterstitialScreen component.
*/
export const ContentWrapper = React.forwardRef<
HTMLDivElement,
ContentWrapperProps
>(
(
{
children,
className,
stepTitle,
// Collect any other property values passed in.
...rest
},
ref
) => {
return (
<div
aria-label={stepTitle}
{
// Pass through any other property values as HTML attributes.
...rest
}
className={className}
ref={ref}>
{children}
</div>
);
}
);

ContentWrapper.displayName = 'ContentWrapper';
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React, { useState } from 'react';
import { settings } from '@carbon-labs/utilities/es/index.js';
import { Column, FlexGrid, Row, SelectableTag } from '@carbon/react';
import './styles/_firstTimeOrientation.scss';

const PersonalizationInterstitial = () => {
const prefix = settings.stablePrefix;

const tags = [
{
id: 1,
text: 'Accelerate process with automation',
},
{
id: 2,
text: 'Proactively identify issues',
},
{
id: 3,
text: 'Accelerate response times',
},
{
id: 4,
text: 'Create rules with greater efficiency',
},
{
id: 5,
text: 'Query faster and monitor in real-time',
},
{
id: 6,
text: 'Stay ahead of emerging issues',
},
{
id: 7,
text: 'Take action with custom and built-in dashboards',
},
];
const [selectedTags, setSelectedTags] = useState([
{
id: 1,
},
{
id: 4,
},
{
id: 6,
},
]);

const handleChange = (tag, selected) => {
const nextSelectedTags = selected
? [...selectedTags, tag]
: selectedTags.filter((t) => t.id !== tag.id);

console.log('Selected tags array: ', nextSelectedTags);
setSelectedTags(nextSelectedTags);
};
return (
<FlexGrid fullWidth className={`${prefix}__flexContainer`}>
<Row>
<Column className={`${prefix}__contentColumn`}>
<div
className={`${prefix}__interstitialTextContainer ${prefix}__firstTimeOrientation`}>
<h4>What experience interest you?</h4>
<p>
Personalize your experience by selecting all areas you want to
explore.
</p>
</div>
<div aria-label="Selectable tags" role="group">
{tags.map((tag, index) => (
<SelectableTag
key={index}
text={tag.text}
selected={!!selectedTags.find((t) => t.id === tag.id)}
onChange={(selected) => handleChange(tag, selected)}
size="lg"
/>
))}
</div>
</Column>
</Row>
</FlexGrid>
);
};

PersonalizationInterstitial.displayName = 'PersonalizationInterstitial';

export { PersonalizationInterstitial };
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import { settings } from '@carbon-labs/utilities/es/index.js';
import { Column, FlexGrid, Row } from '@carbon/react';
import welcomeInterstitialImage from './assets/welcomeInterstitial.png';
import './styles/_firstTimeOrientation.scss';

const WelcomeInterstitial = () => {
const prefix = settings.stablePrefix;
return (
<FlexGrid fullWidth className={`${prefix}__flexContainer`}>
<Row>
<Column sm={4} md={4} className={`${prefix}__contentColumn`}>
<div className={`${prefix}__interstitialTextContainer`}>
<h3>
<span>Built to scale; made for the analyst</span>
</h3>
<p>
Explore how to leverage search-based detection of your logs,
respond to automatically correlated and investigated cases,
advanced data source management, extended detection and response,
and much more.
</p>
</div>
</Column>
<Column sm={4} md={4}>
<img
src={welcomeInterstitialImage}
className={`${prefix}__interstitialImage`}
alt="Welcome interstitial"
/>
</Column>
</Row>
</FlexGrid>
);
};

WelcomeInterstitial.displayName = 'WelcomeInterstitial';

export { WelcomeInterstitial };
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
@use '@carbon/styles/scss/theme' as *;
@use '@carbon/styles/scss/spacing' as *;
@use '@carbon/styles/scss/type' as *;
@use '@carbon/type/scss/font-family' as *;
@use '@carbon/styles/scss/components/tag' as *;
@use '@carbon/ibm-products/scss/components/InterstitialScreen';
@use '@carbon/react/scss/grid/flexbox';
/* example SCSS */
$prefix: 'clabs' !default;

.#{$prefix}__wrapper {
display: flex;
align-items: center;
justify-content: center;
block-size: 100vh;
}
.#{$prefix}__flexContainer {
block-size: 100%;
padding-inline-end: 0;
}
.#{$prefix}__interstitialTextContainer {
margin-block-end: $spacing-09;

h3 {
@include type-style('fluid-heading-05', true);

span.blue-text {
color: $interactive;
}

p {
@include type-style('body-02');
}

margin-block-end: $spacing-05;
}
&.#{$prefix}__firstTimeOrientation {
h3 {
@include type-style('heading-04', true);
}

h4 {
@include type-style('heading-02', true);

margin-block-end: $spacing-03;
}
}
}
.#{$prefix}__contentColumn {
position: relative;
box-sizing: border-box;
padding-block-start: $spacing-10;
}

img.#{$prefix}__interstitialImage {
inline-size: 100%;
}
Loading