Skip to content
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

feat: Editor styles and layout update #2491

Merged
merged 9 commits into from
Nov 30, 2023
Merged

Conversation

ianjon3s
Copy link
Contributor

@ianjon3s ianjon3s commented Nov 28, 2023

What does this PR do?

Two main areas of work addressed:

1. Adding admin setting design feature UI

UI has been added for the following (UI only, no working functionality at present).

  1. Theme colour with colour picker
  2. Logo with file upload
  3. Favicon with file upload

Note: I've added example links to guides for each of these elements. I'll make sure these are in place on our PlanX Notion before the work goes live.

As part of this I have created the EditorRow UI component with optional background variant, to be used for each row of settings.

As guided by @jessicamcinchak this sits behind the feature flag window.featureFlags.toggle("SHOW_TEAM_SETTINGS")

Preview:
https://2491.planx.pizza/buckinghamshire/find-out-if-you-need-planning-permission/settings/design

2. Updating general editor UI

Interwoven with and as an extension of the above, I've given the editor UI a going over with a focus on the following:

  • Unifying input styles, sizes, backgrounds, borders, placeholder text
  • Addressing issues with input layout, particularly layout shift when entering content
  • Unifying focus styles (lots more potential quick-wins from an accessibility POV, but this is a good start)
  • Unifying label and subtitle styles

Preview:
https://2491.planx.pizza/opensystemslab/permitteddevelopment,7GeYLgmnm9/nodes/i0uhcaViKg/nodes/CtyInx9nSU/edit

@ianjon3s ianjon3s changed the title Ian/editor design settings update feat: Editor styles and layout update Nov 28, 2023
Copy link

github-actions bot commented Nov 28, 2023

Removed vultr server and associated DNS entries

@ianjon3s ianjon3s force-pushed the ian/editor-design-settings-update branch from 775e0df to 18ff5f2 Compare November 28, 2023 17:08
</Box>
</Box>
</>
</EditorRow>
Copy link
Member

Choose a reason for hiding this comment

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

Since we're planning to do a dev pass-off of this settings panel, this might be a good scenario for a feature flag!

To feature flag this new design panel:

  • You could add a new flag value to AVAILABLE_FEATURE_FLAGS like "SHOW_TEAM_SETTINGS" in src/lib/featureFlags.ts
  • Then in this file you could call hasFeatureFlag("SHOW_TEAM_SETTINGS") to conditionally render either the original "Feature in development" placeholder or the new form inputs here

Does that make sense? Will make it much easier to merge design changes and then pick up dev work in separate PRs without risking confusion of any curious editors in the meantime. To test, you can run window.featureFlags.toggle("SHOW_TEAM_SETTINGS") in the console

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes absolutely, makes a lot more sense than extracting into separate PRs, I'll work to get this into this PR.

@ianjon3s ianjon3s requested a review from a team November 29, 2023 16:50
@ianjon3s ianjon3s marked this pull request as ready for review November 29, 2023 16:50
Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

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

Looks fantastic, honestly a huge improvement 🎉

A few very minor comments, happy for this to be merged as is and they can be picked up as small follow on PRs - whatever works best for you 👍

should be 32x32px and in .ico or .png format.
</InputDescription>
<InputDescription>
<Link href="https://www.planx.uk">
Copy link
Contributor

Choose a reason for hiding this comment

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

When these get updated we'll also want a target="_blank" attribute so they open in a new tab 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

A potential follow on task (in another PR!) might be splitting this /ui folder into /public, /editor and /shared subfolders.

At the moment the list is pretty big and knowing what components are available and used can be a bit of a challenge!

Comment on lines +11 to +15
export default function InputDescription({
children,
}: {
children: ReactNode;
}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: This could be slightly simplified by using the PropsWithChildren type.

We can annotate the component with something like React.FC<PropsWithChildren> and it will handle some of this boilerplate for us. There should be a few examples of this in the codebase you can take a look at 👍

paddingBottom: theme.spacing(2),
}));
})) as typeof Typography;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I believe that the as typeof Typography is redundant here (and below in Subtitle). This is only needed when we're using another component type - i.e. passing a prop like component="legend" into the template.

}));

export const ModalSubtitle: React.FC<Props> = ({ title }) => (
<Root sx={{ display: "flex" }}>
<StyledTypography variant="body2">{title}</StyledTypography>
<StyledTypography variant="subtitle2">{title}</StyledTypography>
Copy link
Contributor

Choose a reason for hiding this comment

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

This totally doesn't need to change, but just a heads up that you can feel free to use the sx prop (or even just p={something}) when you only have a few style attributes to add to a component.

No hard and fast rules here at all, it's usually nice to abstract style away from structure, but it can be a useful / quick method.

Docs: https://mui.com/system/getting-started/the-sx-prop/

Copy link
Contributor

Choose a reason for hiding this comment

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

Follow on comment from this morning - in another PR (no rush!) it would be nice to tidy this up and move these styles into a React styled component if possible.

I suspect that ProseMirror (the library used for rich text editing) is looking for these specific class names so it should be a fairly easy port across.

@ianjon3s
Copy link
Contributor Author

Much appreciated @DafyddLlyr , I'll merge this now to avoid blocking further editor work, and break down the separate tasks as PRs as you suggest.

@ianjon3s ianjon3s merged commit ce69253 into main Nov 30, 2023
12 checks passed
@DafyddLlyr DafyddLlyr deleted the ian/editor-design-settings-update branch November 30, 2023 12:16
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