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

Theme fixes #24883

Merged
merged 35 commits into from
May 4, 2023
Merged

Theme fixes #24883

merged 35 commits into from
May 4, 2023

Conversation

gzdunek
Copy link
Contributor

@gzdunek gzdunek commented Apr 20, 2023

This PR mainly adjusts Connect to the updated dark theme. Some of the changes affect also the WebUI, so @rudream I'd be grateful if you could take a look at the non-Connect commits (up to this one 80f2124).

Justification for the changes that affect WebUI:

@ravicious if something in Connect doesn't look right, feel free to commit fixes.

image

web/packages/design/src/TextArea/TextArea.tsx Show resolved Hide resolved
web/packages/teleterm/src/ui/Search/SearchBar.tsx Outdated Show resolved Hide resolved
}

padding: ${props => props.theme.space[2]}px;
color: ${props => props.theme.colors.text.contrast};
background: ${props => props.theme.colors.levels.surface};
background: inherit;
Copy link
Member

Choose a reason for hiding this comment

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

This can be removed.

&:active {
border: 1px solid ${theme.colors.text.secondary};
}
background: inherit;
Copy link
Member

Choose a reason for hiding this comment

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

This is to work around the fact that form elements are not aware of the surface level they're used at, right?

@rudream did you run into similar problems in the Web UI? This feels like an interesting problem to take care of in the future.

This is the background of the textarea that is shown when you click on the little chat icon in the bottom right corner.

Copy link
Member

Choose a reason for hiding this comment

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

Well, maybe it's not even that interesting. If we want those field forms to be flat, they could just not set the background color by themselves and instead inherit it, as shown here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it makes sense to inherit parent color, but I was afraid to change it for Input which is used in a lot of places :/

Copy link
Contributor

Choose a reason for hiding this comment

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

@rudream did you run into similar problems in the Web UI? This feels like an interesting problem to take care of in the future.

For the inputs I generally used transparent background as opposed to inherit (I think in this case the end result is the same). Yes, this is because the element isn't aware of what surface level it's at, using a solid colour background would look like transparency on a background of the same colour but would look out of place on a different elevation (such as in a dialog).


popout: '#4A5688',
},

brand: '#512FC9',
brand: '#9F85FF',
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we import those directly from the dark theme instead of copying them here? In the end, shouldn't the Web UI and Connect use the same themes? cc @rudream

Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that even before the theme updates, Connect used slightly different colours than the Web UI (you can compare the theme.ts files for both in branch/v12). I didn't want to disrupt this as I know we don't have official designs for the updated Connect themes yet so I duplicated some colours just for the sake of compatibility with our shared design components.

I don't know if the Connect dark theme is supposed to look exactly like the Web UI dark theme (since it didn't in the past), but if it does then yes we should be importing the themes from the Web UI as opposed to using a duplicate. I did this to get the MVP for the Web UI out in time without breaking Connect since that was the priority.

web/packages/teleterm/src/ui/ThemeProvider/theme.ts Outdated Show resolved Hide resolved
@ravicious
Copy link
Member

I'll try out those changes tomorrow, so far I've been just going through the code and used the search bar.

@ravicious ravicious self-requested a review April 20, 2023 13:38
Copy link
Member

@ravicious ravicious left a comment

Choose a reason for hiding this comment

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

Love to see Connect just directly importing the colors from the dark theme. Great job @gzdunek and @rudream!

Comment on lines 109 to 110
&:hover > input {
background: ${props => props.theme.colors.spotBackground[0]};
Copy link
Member

Choose a reason for hiding this comment

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

This could be defined on Input itself, couldn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

web/packages/teleterm/src/ui/TopBar/TopBar.tsx Outdated Show resolved Hide resolved
# Conflicts:
#	e
#	web/packages/design/src/Input/Input.jsx
#	web/packages/design/src/Menu/MenuItem.jsx
#	web/packages/shared/components/FieldInput/__snapshots__/FieldInput.test.tsx.snap
#	web/packages/shared/components/FormPassword/__snapshots__/FormPassword.test.tsx.snap
#	web/packages/shared/components/MenuLogin/MenuLogin.tsx
#	web/packages/teleport/src/Account/ManageDevices/AddDevice/__snapshots__/AddDevice.story.test.tsx.snap
#	web/packages/teleport/src/Welcome/NewCredentials/__snapshots__/NewCredentials.story.test.tsx.snap
#	web/packages/teleport/src/components/FormLogin/__snapshots__/FormLogin.story.test.tsx.snap
#	web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/ClusterSearch.tsx
#	web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/MenuLoginTheme.tsx
#	web/packages/teleterm/src/ui/QuickInput/QuickInput.tsx
#	web/packages/teleterm/src/ui/QuickInput/QuickInputList/QuickInputList.tsx
#	web/packages/teleterm/src/ui/Search/SearchBar.tsx
#	web/packages/teleterm/src/ui/Search/pickers/PickerContainer.ts
#	web/packages/teleterm/src/ui/Search/pickers/ResultList.tsx
#	web/packages/teleterm/src/ui/StatusBar/ShareFeedback/ShareFeedbackFormFields.tsx
#	web/packages/teleterm/src/ui/Tabs/TabItem.tsx
#	web/packages/teleterm/src/ui/ThemeProvider/theme.ts
#	web/packages/teleterm/src/ui/TopBar/Clusters/ClustersFilterableList/ClusterItem.tsx
#	web/packages/teleterm/src/ui/components/FilterableList/FilterableList.tsx
#	web/packages/teleterm/src/ui/components/ListItem.tsx
#	web/packages/teleterm/src/ui/components/Table.tsx
Copy link
Member

@ravicious ravicious left a comment

Choose a reason for hiding this comment

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

Left some comments about some minor issues but the rest looks good!

`}
justifyContent="center"
ref={containerRef}
onFocus={handleOnFocus}
>
{!isOpen && (
<>
<Input {...defaultInputProps} />
<Input {...defaultInputProps} css={`
Copy link
Member

Choose a reason for hiding this comment

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

By this being defined on the input itself I meant moving it within the component declaration that starts with const Input = styled.input.

Copy link
Member

Choose a reason for hiding this comment

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

Though what's wrong with defining the background color the way it was, on the flex itself?

&:hover {
color: ${props => props.theme.colors.levels.contrast};
background: ${props => props.theme.colors.levels.surface};
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I added the semi-transparent hover on the div level, it was brighter than it should (like alpha was 0.14 not 0.07). I don't know why this happened, the input inherited background from the parent. For some reason hover on the div and the input looked a bit different.
But now I found a way to fix it, I only need to set transparent background for the input.

@@ -111,6 +111,7 @@ export function DocumentTerminal(props: Props & { visible: boolean }) {
visible={visible}
flexDirection="column"
pl={2}
pt={1}
Copy link
Member

Choose a reason for hiding this comment

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

Looks good but let's add a comment explaining what the top padding is for.

@@ -59,6 +59,7 @@ export const Items = (props: { maxWidth: string }) => {
max-width: ${maxWidth};
min-width: 0;
flex: 1;
background-color: ${props => props.theme.colors.levels.elevated};
Copy link
Member

Choose a reason for hiding this comment

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

Let's replace <Flex gap={4}> above with <Flex gap={4} alignItems="flex-start"> to get rid of the second column stretching all the way down.

Copy link
Contributor

@rudream rudream left a comment

Choose a reason for hiding this comment

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

LGTM

gzdunek and others added 4 commits May 4, 2023 16:30
* Use a better icon for the reverse tunnel cell

* Use `ButtonIcon` for pagination icons

* Fix rendering table border on Safari

* Manually add a visual separator between the table and the element below it

* Add bottom padding to resource tables in Connect

* Update snapshots
# Conflicts:
#	e
#	web/packages/teleport/src/Audit/__snapshots__/Audit.story.test.tsx.snap
@gzdunek gzdunek added this pull request to the merge queue May 4, 2023
Merged via the queue into master with commit 1870c80 May 4, 2023
19 checks passed
@gzdunek gzdunek deleted the gzdunek/theme-updates branch May 4, 2023 15:33
@public-teleport-github-review-bot

@gzdunek See the table below for backport results.

Branch Result
branch/v13 Failed

gzdunek added a commit that referenced this pull request May 4, 2023
* Theme fixes (#24883)

* Make pagination icons a little more visible

* Use different color for `tr` border

* Use `opacity: 1` for placeholders

* Include `borderRadius` in `StyledPanel` to fix rounded corners in Connect custom tables

* Use `colors.text.primary` for items in `MenuLogin`

* Adjust Connect theme to the updated dark theme

* Remove unused component

* Update snapshots

* Remove `surfaceSecondary` and `sunkenSecondary` colors

* Remove unneeded `inherit`

* Do not hardcode bg color in `TextArea`

* Expand comment

* Simplify the look of top bar elements

* Remove unused component

* Remove `text.contrast`

* Use the same dark theme for WebUI and Connect

* Revert "Make pagination icons a little more visible"

This reverts commit 1fe1d7b.

* Add shadow for the tabs

* Post-merge fixes

* Do not use Arial on custom buttons

* Revert snapshot changes

* Fix colors in `ActionPicker`

* Apply hover styles directly on `SearchBar` input

* Use white color for "Database Connection" header

* Add shadow directly to `StyledTabs`

* Run prettier

* Update e

* Add some top padding to the terminal

* Review fixes

* Move SearchBar hover to the Flex element

* Table-related improvements  (#25333)

* Use a better icon for the reverse tunnel cell

* Use `ButtonIcon` for pagination icons

* Fix rendering table border on Safari

* Manually add a visual separator between the table and the element below it

* Add bottom padding to resource tables in Connect

* Update snapshots

* Update snapshots

* Revert e

(cherry picked from commit 1870c80)

* Update `Session.story.test.tsx.snap`
@r0mant r0mant mentioned this pull request Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants