-
Notifications
You must be signed in to change notification settings - Fork 36
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
amal-k-joy
wants to merge
29
commits into
carbon-design-system:main
Choose a base branch
from
amal-k-joy:interstitialPattern
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 400a0e6
feat: add first time orientation pattern and its example usage
amal-k-joy 043de52
feat: update yarn.lock
amal-k-joy c4f0f80
fix: lint and format
amal-k-joy bc8146a
fix: corect example
amal-k-joy 100799f
fix: update docs
amal-k-joy 57d0645
fix: build
amal-k-joy ab9846d
fix: license and doc update
amal-k-joy 754dead
Merge branch 'main' into interstitialPattern
amal-k-joy 255f08c
Update packages/react/src/components/WhatsNew/__stories__/FirstTimeOr…
amal-k-joy a262be5
Update packages/react/src/components/WhatsNew/__stories__/WhatsNew.mdx
amal-k-joy a6e084b
Update packages/react/src/components/WhatsNew/__stories__/WhatsNew.mdx
amal-k-joy 36c20d1
fix: move firstTimeOrientation to patterns main level
amal-k-joy 1317932
fix: yarn install
amal-k-joy 30bce45
fix: yarn resolve conflicts
amal-k-joy 5ec5b32
fix: yarn install 2
amal-k-joy bb7a415
fix: add index.ts file
amal-k-joy 2f07b42
fix: build issue
amal-k-joy 2b174ed
fix: build issue 2
amal-k-joy 94ecb99
fix: remove old files
amal-k-joy 3766ce1
fix: build issue 3
amal-k-joy 6c335de
fix: build issue 4
amal-k-joy c26eecb
fix: build issue 5
amal-k-joy 4cb9c41
fix: lint fix
amal-k-joy b63763a
Update packages/react/src/components/FirstTimeOrientation/__stories__…
amal-k-joy be71888
Update packages/react/src/components/FirstTimeOrientation/__stories__…
amal-k-joy b444c99
Update examples/react/FirstTimeOrientation/src/components/Personaliza…
amal-k-joy 0db7ef2
fix: remove story duplication
amal-k-joy e7d1a94
fix: review comment to restore @carbon/ibm-products version
amal-k-joy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
64 changes: 64 additions & 0 deletions
64
examples/react/FirstTimeOrientation/src/components/ContentWrapper.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
99 changes: 99 additions & 0 deletions
99
examples/react/FirstTimeOrientation/src/components/PersonalizationInterstitial.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
48 changes: 48 additions & 0 deletions
48
examples/react/FirstTimeOrientation/src/components/WelcomeInterstitial.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
Binary file added
BIN
+712 KB
examples/react/FirstTimeOrientation/src/components/assets/welcomeInterstitial.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions
65
examples/react/FirstTimeOrientation/src/components/styles/_firstTimeOrientation.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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%; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.