Skip to content

Theme generator Preview (Step 2)#2417

Open
Mil4n0r wants to merge 15 commits intotheme-generatorfrom
Mil4n0r/theme-generator-preview
Open

Theme generator Preview (Step 2)#2417
Mil4n0r wants to merge 15 commits intotheme-generatorfrom
Mil4n0r/theme-generator-preview

Conversation

@Mil4n0r
Copy link
Collaborator

@Mil4n0r Mil4n0r commented Mar 2, 2026

Checklist
(Check off all the items before submitting)

  • Build process is done without errors. All tests pass in the /lib directory.
  • Self-reviewed the code before submitting.
  • Meets accessibility standards.
  • Added/updated documentation to /website as needed.
  • Added/updated tests as needed.

Added step 2 for theme generator config.

Still need to address the issue with the layout for having scroll inside the preview area. The rest can be reviewed.

Merge step 1 first if possible.

@raquelarrojo raquelarrojo requested review from raquelarrojo and removed request for raquelarrojo March 3, 2026 08:05
@Mil4n0r Mil4n0r marked this pull request as ready for review March 5, 2026 15:11
@Mil4n0r Mil4n0r requested a review from raquelarrojo March 5, 2026 15:48
}}
mode="secondary"
semantic="error"
disabled={mode === "components" ? selectedComponents.length === 0 : !!selectedExample}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic of the delete button is inverted in examples mode. When an example is selected, the delete button is disabled instead of enabled (and vice versa).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

import { useMemo, useState } from "react";
import componentsList from "../common/componentsList.json";
import { componentsRegistry, examplesRegistry } from "screens/utilities/theme-generator/componentsRegistry";
import { ListOptionType } from "../../../../packages/lib/src/select/types";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be imported from @dxc-technology/halstack-react ? instead of this cross-package import?.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't currently export types. (We should ideally use something like DefinitelyTyped). For now I can simply repeat the typing in this file, is it okay?


// TODO: this is just a quick solution to make the preview area scrollable when the content is too big, I don't know what other approach that doesn't
// involve adding custom styles could be used. (fullHeight does not do anything here either)
const CustomPreviewArea = styled(DxcFlex)`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of overriding the DxcFlex styles, I think it would be better to create a native div element with display: flex; and overflow: hidden;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

return mapToSelectGroups(componentsList as ComponentItem[]);
}, []);

const exampleOptions = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a static array, could it be moved outside the component?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@@ -0,0 +1,177 @@
import { DxcButton, DxcContainer, DxcFlex, DxcSelect, DxcToggleGroup } from "@dxc-technology/halstack-react";
import { useMemo, useState } from "react";
import componentsList from "../common/componentsList.json";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The layout components should not appear in the component list. Only components affected by theme colours should appear in the selector. 'Bleed', 'Container', 'Flex', 'Grid', 'Inset' and 'Popover' layout components are not visually affected by colour tokens and should not be selectable. The same applies to dialog, card and text components.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Application and dashboard examples should render the header and footer. If they do not, I think it is not possible to preview the logos, for example.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Login example doesn't make much sense as a standalone preview in this context.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include a disclaimer with these examples, explaining that they are just suggestions?

Copy link
Collaborator

@raquelarrojo raquelarrojo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add some real context to the previews. Avoid "Label", "Sublabel", First step", "Second step" and give real values.

{mode === "components" && (
<DxcSelect
placeholder="Select components"
options={componentOptions}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this select be medium size? Seems to be larger than in design.
I would add searchable functionality to the select to make it easier the selection.

disabled={mode === "components" ? selectedComponents.length === 0 : !selectedExample}
/>
</DxcFlex>
<CustomPreviewArea>{displayedPreview}</CustomPreviewArea>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thin we should add a message like in design when there is no selected component, like Select a component to preview

primaryText="John Doe"
secondaryText="johndoe@company.com"
status={{ mode: "success", position: "top" }}
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should avoid scroll and add the avatar previews in more than one row.

Image

import { DxcImage } from "@dxc-technology/halstack-react";

const ImagePreview = () => {
return <DxcImage src="https://placehold.co/600x400" alt="Sample image" />;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes it sense to add the image preview? Can it be customizable?

/>
</DxcFlex>
<CustomPreviewArea>{displayedPreview}</CustomPreviewArea>
</DxcFlex>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could add the Component name as a title above each preview. We can confirm with design but I thinks it would be helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants