mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-02 01:17:58 +02:00
chore: demo misc improvements (#9796)
https://linear.app/unleash/issue/2-2577/transition-screen-between-the-guides https://linear.app/unleash/issue/2-2582/page-scrolls-in-back Includes what should be the last batch of demo improvements at this stage: - Visually aligns the Back button for consistent layout - Replaces “Start” with “Start tutorial” for new topics - Updates topic titles for clarity and consistency - Applies bold styling to all step titles - Prevents page scroll when the step target is set to body
This commit is contained in:
parent
e6813a4910
commit
ee9b0a0193
@ -63,12 +63,18 @@ const StyledTooltipTitle = styled('div')(({ theme }) => ({
|
|||||||
const StyledTooltipActions = styled('div')(({ theme }) => ({
|
const StyledTooltipActions = styled('div')(({ theme }) => ({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'center',
|
||||||
marginTop: theme.spacing(3),
|
marginTop: theme.spacing(3),
|
||||||
'&&& button': {
|
'&&& button': {
|
||||||
fontSize: theme.fontSizes.smallBody,
|
fontSize: theme.fontSizes.smallBody,
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const StyledBackButton = styled(Button)({
|
||||||
|
padding: 0,
|
||||||
|
minWidth: 0,
|
||||||
|
});
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export interface IDemoStepTooltipProps extends TooltipRenderProps {
|
export interface IDemoStepTooltipProps extends TooltipRenderProps {
|
||||||
step: ITutorialTopicStep;
|
step: ITutorialTopicStep;
|
||||||
@ -92,7 +98,7 @@ export const DemoStepTooltip = ({
|
|||||||
}: IDemoStepTooltipProps) => {
|
}: IDemoStepTooltipProps) => {
|
||||||
const nextLabel =
|
const nextLabel =
|
||||||
stepIndex === 0
|
stepIndex === 0
|
||||||
? 'Start'
|
? 'Start tutorial'
|
||||||
: stepIndex === topics[topic].steps.length - 1
|
: stepIndex === topics[topic].steps.length - 1
|
||||||
? 'Finish'
|
? 'Finish'
|
||||||
: 'Next';
|
: 'Next';
|
||||||
@ -112,28 +118,23 @@ export const DemoStepTooltip = ({
|
|||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</StyledCloseButton>
|
</StyledCloseButton>
|
||||||
<StyledTooltipTitle>
|
<StyledTooltipTitle>
|
||||||
<ConditionallyRender
|
|
||||||
condition={Boolean(step.title)}
|
|
||||||
show={step.title}
|
|
||||||
elseShow={
|
|
||||||
<Typography fontWeight='bold'>
|
<Typography fontWeight='bold'>
|
||||||
{topics[topic].title}
|
{step.title || topics[topic].title}
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
|
||||||
/>
|
|
||||||
</StyledTooltipTitle>
|
</StyledTooltipTitle>
|
||||||
{step.content}
|
{step.content}
|
||||||
<StyledTooltipActions>
|
<StyledTooltipActions>
|
||||||
<div>
|
<div>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={topic > 0 || stepIndex > 0}
|
condition={
|
||||||
|
!step.hideBackButton && stepIndex > 0
|
||||||
|
}
|
||||||
show={
|
show={
|
||||||
<Button
|
<StyledBackButton
|
||||||
variant='text'
|
|
||||||
onClick={() => onBack(step)}
|
onClick={() => onBack(step)}
|
||||||
>
|
>
|
||||||
Back
|
Back
|
||||||
</Button>
|
</StyledBackButton>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -164,25 +165,19 @@ export const DemoStepTooltip = ({
|
|||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</StyledCloseButton>
|
</StyledCloseButton>
|
||||||
<StyledTooltipTitle>
|
<StyledTooltipTitle>
|
||||||
<ConditionallyRender
|
|
||||||
condition={Boolean(step.title)}
|
|
||||||
show={step.title}
|
|
||||||
elseShow={
|
|
||||||
<Typography fontWeight='bold'>
|
<Typography fontWeight='bold'>
|
||||||
{topics[topic].title}
|
{step.title || topics[topic].title}
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
|
||||||
/>
|
|
||||||
</StyledTooltipTitle>
|
</StyledTooltipTitle>
|
||||||
{step.content}
|
{step.content}
|
||||||
<StyledTooltipActions>
|
<StyledTooltipActions>
|
||||||
<div>
|
<div>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={topic > 0 || stepIndex > 0}
|
condition={!step.hideBackButton && stepIndex > 0}
|
||||||
show={
|
show={
|
||||||
<Button variant='text' onClick={() => onBack(step)}>
|
<StyledBackButton onClick={() => onBack(step)}>
|
||||||
Back
|
Back
|
||||||
</Button>
|
</StyledBackButton>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -118,6 +118,8 @@ export const DemoSteps = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (action === ACTIONS.UPDATE) {
|
if (action === ACTIONS.UPDATE) {
|
||||||
|
if (step.target === 'body') return;
|
||||||
|
|
||||||
const el = document.querySelector(
|
const el = document.querySelector(
|
||||||
step.target as string,
|
step.target as string,
|
||||||
) as HTMLElement | null;
|
) as HTMLElement | null;
|
||||||
|
@ -37,10 +37,10 @@ const ENVIRONMENT = 'dev';
|
|||||||
|
|
||||||
export const TOPICS: ITutorialTopic[] = [
|
export const TOPICS: ITutorialTopic[] = [
|
||||||
{
|
{
|
||||||
title: 'Enable/disable a feature flag',
|
title: 'How to enable/disable a feature flag',
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
title: 'Enable/disable a feature flag',
|
title: 'How to enable/disable a feature flag',
|
||||||
href: `/projects/${PROJECT}?sort=name`,
|
href: `/projects/${PROJECT}?sort=name`,
|
||||||
target: 'body',
|
target: 'body',
|
||||||
placement: 'center',
|
placement: 'center',
|
||||||
@ -91,11 +91,11 @@ export const TOPICS: ITutorialTopic[] = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Enable for a specific user',
|
title: 'Next: How to enable for a specific user',
|
||||||
setup: specificUser,
|
setup: specificUser,
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
title: 'Enable for a specific user',
|
title: 'Next: How to enable for a specific user',
|
||||||
href: `/projects/${PROJECT}?sort=name`,
|
href: `/projects/${PROJECT}?sort=name`,
|
||||||
target: 'body',
|
target: 'body',
|
||||||
placement: 'center',
|
placement: 'center',
|
||||||
@ -335,11 +335,11 @@ export const TOPICS: ITutorialTopic[] = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Adjust gradual rollout',
|
title: 'Next: How to adjust gradual rollout',
|
||||||
setup: gradualRollout,
|
setup: gradualRollout,
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
title: 'Adjust gradual rollout',
|
title: 'Next: How to adjust gradual rollout',
|
||||||
href: `/projects/${PROJECT}?sort=name`,
|
href: `/projects/${PROJECT}?sort=name`,
|
||||||
target: 'body',
|
target: 'body',
|
||||||
placement: 'center',
|
placement: 'center',
|
||||||
@ -468,11 +468,11 @@ export const TOPICS: ITutorialTopic[] = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Adjust variants',
|
title: 'Next: How to adjust variants',
|
||||||
setup: variants,
|
setup: variants,
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
title: 'Adjust variants',
|
title: 'Next: How to adjust variants',
|
||||||
href: `/projects/${PROJECT}?sort=name`,
|
href: `/projects/${PROJECT}?sort=name`,
|
||||||
target: 'body',
|
target: 'body',
|
||||||
placement: 'center',
|
placement: 'center',
|
||||||
|
Loading…
Reference in New Issue
Block a user