mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-04 00:18:40 +01:00
feat: demo small UI adjustments (#3653)
https://linear.app/unleash/issue/2-975/small-ui-adjustments Adds some small UI adjustments we identified in the meantime: - "Get Unleash" -> "Get started" in the top banner; - Topics list header is now the same color as the top banner; - Added `focus` capabilities to steps, added it to the appropriate steps; - No longer closes tooltip when clicked when using `anyClick`; - Reversed the topics list header arrow rotation; Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item: #3537 
This commit is contained in:
parent
e7dec9a8a4
commit
9df9095b1f
@ -56,7 +56,7 @@ export const DemoBanner = ({ onPlans }: IDemoBannerProps) => {
|
|||||||
Ask questions
|
Ask questions
|
||||||
</StyledQuestionsButton>
|
</StyledQuestionsButton>
|
||||||
<StyledButton variant="contained" color="primary" onClick={onPlans}>
|
<StyledButton variant="contained" color="primary" onClick={onPlans}>
|
||||||
Get Unleash
|
Get started
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
</StyledBanner>
|
</StyledBanner>
|
||||||
);
|
);
|
||||||
|
@ -104,11 +104,25 @@ export const DemoSteps = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (action === ACTIONS.UPDATE) {
|
if (action === ACTIONS.UPDATE) {
|
||||||
const el = document.querySelector(step.target as string);
|
const el = document.querySelector(
|
||||||
|
step.target as string
|
||||||
|
) as HTMLElement | null;
|
||||||
if (el) {
|
if (el) {
|
||||||
el.scrollIntoView({
|
el.scrollIntoView({
|
||||||
block: 'center',
|
block: 'center',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (step.focus) {
|
||||||
|
if (step.focus === true) {
|
||||||
|
el.focus();
|
||||||
|
} else {
|
||||||
|
const focusEl = el.querySelector(
|
||||||
|
step.focus
|
||||||
|
) as HTMLElement | null;
|
||||||
|
focusEl?.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!step.nextButton) {
|
if (!step.nextButton) {
|
||||||
const clickHandler = (e: Event) => {
|
const clickHandler = (e: Event) => {
|
||||||
abortController.abort();
|
abortController.abort();
|
||||||
@ -119,9 +133,17 @@ export const DemoSteps = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (step.anyClick) {
|
if (step.anyClick) {
|
||||||
window.addEventListener('click', clickHandler, {
|
window.addEventListener(
|
||||||
signal: abortController.signal,
|
'click',
|
||||||
});
|
e => {
|
||||||
|
const targetEl = e.target as HTMLElement;
|
||||||
|
if (!targetEl.closest('.__floater'))
|
||||||
|
clickHandler(e);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
signal: abortController.signal,
|
||||||
|
}
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
el.addEventListener('click', clickHandler, {
|
el.addEventListener('click', clickHandler, {
|
||||||
signal: abortController.signal,
|
signal: abortController.signal,
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
LinearProgress,
|
LinearProgress,
|
||||||
Typography,
|
Typography,
|
||||||
|
alpha,
|
||||||
linearProgressClasses,
|
linearProgressClasses,
|
||||||
styled,
|
styled,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
@ -33,9 +34,10 @@ const StyledAccordion = styled(Accordion)(({ theme }) => ({
|
|||||||
right: theme.spacing(2),
|
right: theme.spacing(2),
|
||||||
fontSize: theme.fontSizes.mainHeader,
|
fontSize: theme.fontSizes.mainHeader,
|
||||||
transition: 'transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
|
transition: 'transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
|
||||||
|
transform: 'rotate(180deg)',
|
||||||
},
|
},
|
||||||
'&.Mui-expanded .expand-icon': {
|
'&.Mui-expanded .expand-icon': {
|
||||||
transform: 'rotate(180deg)',
|
transform: 'rotate(0)',
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -44,8 +46,8 @@ const StyledAccordionSummary = styled(AccordionSummary)(({ theme }) => ({
|
|||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
},
|
},
|
||||||
backgroundColor: theme.palette.primary.main,
|
backgroundColor: theme.palette.web.main,
|
||||||
color: theme.palette.primary.contrastText,
|
color: theme.palette.web.contrastText,
|
||||||
borderTopLeftRadius: theme.shape.borderRadiusLarge,
|
borderTopLeftRadius: theme.shape.borderRadiusLarge,
|
||||||
borderTopRightRadius: theme.shape.borderRadiusLarge,
|
borderTopRightRadius: theme.shape.borderRadiusLarge,
|
||||||
height: 91,
|
height: 91,
|
||||||
@ -84,11 +86,11 @@ const StyledLinearProgress = styled(LinearProgress)(({ theme }) => ({
|
|||||||
height: theme.spacing(1),
|
height: theme.spacing(1),
|
||||||
borderRadius: theme.shape.borderRadius,
|
borderRadius: theme.shape.borderRadius,
|
||||||
[`&.${linearProgressClasses.colorPrimary}`]: {
|
[`&.${linearProgressClasses.colorPrimary}`]: {
|
||||||
backgroundColor: theme.palette.primary.dark,
|
backgroundColor: alpha(theme.palette.web.contrastText!, 0.1),
|
||||||
},
|
},
|
||||||
[`& .${linearProgressClasses.bar}`]: {
|
[`& .${linearProgressClasses.bar}`]: {
|
||||||
borderRadius: theme.shape.borderRadius,
|
borderRadius: theme.shape.borderRadius,
|
||||||
backgroundColor: theme.palette.primary.contrastText,
|
backgroundColor: theme.palette.web.contrastText,
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ export interface ITutorialTopicStep extends Step {
|
|||||||
preventDefault?: boolean;
|
preventDefault?: boolean;
|
||||||
anyClick?: boolean;
|
anyClick?: boolean;
|
||||||
optional?: boolean;
|
optional?: boolean;
|
||||||
|
focus?: boolean | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITutorialTopic {
|
export interface ITutorialTopic {
|
||||||
@ -212,6 +213,7 @@ export const TOPICS: ITutorialTopic[] = [
|
|||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
nextButton: true,
|
nextButton: true,
|
||||||
|
focus: 'input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
target: 'button[data-testid="CONSTRAINT_VALUES_ADD_BUTTON"]',
|
target: 'button[data-testid="CONSTRAINT_VALUES_ADD_BUTTON"]',
|
||||||
@ -440,6 +442,7 @@ export const TOPICS: ITutorialTopic[] = [
|
|||||||
),
|
),
|
||||||
backCloseModal: true,
|
backCloseModal: true,
|
||||||
nextButton: true,
|
nextButton: true,
|
||||||
|
focus: 'input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
target: 'div[data-testid="VARIANT"]:last-of-type #variant-payload-value',
|
target: 'div[data-testid="VARIANT"]:last-of-type #variant-payload-value',
|
||||||
@ -456,6 +459,7 @@ export const TOPICS: ITutorialTopic[] = [
|
|||||||
</Description>
|
</Description>
|
||||||
),
|
),
|
||||||
nextButton: true,
|
nextButton: true,
|
||||||
|
focus: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
target: 'div[data-testid="VARIANT"]:last-of-type button[data-testid="VARIANT_ADD_OVERRIDE_BUTTON"]',
|
target: 'div[data-testid="VARIANT"]:last-of-type button[data-testid="VARIANT_ADD_OVERRIDE_BUTTON"]',
|
||||||
@ -499,6 +503,7 @@ export const TOPICS: ITutorialTopic[] = [
|
|||||||
),
|
),
|
||||||
nextButton: true,
|
nextButton: true,
|
||||||
backCloseModal: true,
|
backCloseModal: true,
|
||||||
|
focus: 'input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
target: 'button[data-testid="DIALOGUE_CONFIRM_ID"]',
|
target: 'button[data-testid="DIALOGUE_CONFIRM_ID"]',
|
||||||
|
Loading…
Reference in New Issue
Block a user