Skip to content

Commit e91db4b

Browse files
authored
Cleanup even more global styles (streamlit#9861)
## Describe your changes This PR removes a couple more unused global styles. These were added and used a long time ago, but the latest state uses styles defined directly with the relevant components. This cleanup is related to the advanced theming project. ## Testing Plan - No logical or visual changes. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
1 parent bb3bacd commit e91db4b

File tree

2 files changed

+18
-57
lines changed

2 files changed

+18
-57
lines changed

frontend/lib/src/components/shared/BaseButton/styled-components.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export const StyledBaseButton = styled.button<RequiredBaseButtonProps>(
100100
minHeight: theme.sizes.minElementHeight,
101101
margin: theme.spacing.none,
102102
lineHeight: theme.lineHeights.base,
103+
textTransform: "none",
103104
fontSize: "inherit",
104105
fontFamily: "inherit",
105106
color: "inherit",

frontend/lib/src/theme/globalStyles.ts

Lines changed: 17 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ import { transparentize } from "color2k"
1919

2020
import { EmotionTheme } from "@streamlit/lib/src/theme"
2121

22+
/**
23+
* Contains various styles that are applied globally to the app.
24+
*
25+
* Please only add styles here if they are truly global. Putting styles to the
26+
* individual components should be strongly preferred.
27+
*/
2228
export const globalStyles = (theme: EmotionTheme): SerializedStyles => css`
2329
// Override the base font-size value here.
24-
// This overrides the value set in reboot.scss.
2530
html {
2631
font-size: ${theme.fontSizes.mdPx}px;
2732
}
@@ -30,21 +35,13 @@ export const globalStyles = (theme: EmotionTheme): SerializedStyles => css`
3035
@media print {
3136
html {
3237
height: 100%;
33-
// make background-colors appear by default (e.g. the sidebar background, widget background, multi-select element background, ...)
38+
// make background-colors appear by default (e.g. the sidebar background,
39+
// widget background, multi-select element background, ...)
3440
print-color-adjust: exact;
3541
-webkit-print-color-adjust: exact;
3642
}
3743
}
3844
39-
// Embedded Overflow Management
40-
body.embedded {
41-
overflow: hidden;
42-
}
43-
44-
body.embedded:hover {
45-
overflow: auto;
46-
}
47-
4845
*,
4946
*::before,
5047
*::after {
@@ -70,6 +67,15 @@ export const globalStyles = (theme: EmotionTheme): SerializedStyles => css`
7067
-webkit-font-smoothing: auto;
7168
}
7269
70+
// Embedded Overflow Management
71+
body.embedded {
72+
overflow: hidden;
73+
}
74+
75+
body.embedded:hover {
76+
overflow: auto;
77+
}
78+
7379
// Future-proof rule: in browsers that support :focus-visible, suppress the focus outline
7480
// on elements that programmatically receive focus but wouldn't normally show a visible
7581
// focus outline. In general, this would mean that the outline is only applied if the
@@ -140,31 +146,6 @@ export const globalStyles = (theme: EmotionTheme): SerializedStyles => css`
140146
vertical-align: middle;
141147
}
142148
143-
// Forms
144-
//
145-
// 1. Allow labels to use margin for spacing.
146-
147-
label {
148-
display: inline-block; // 1
149-
}
150-
151-
// Remove the default border-radius that macOS Chrome adds.
152-
// See https://github.com/twbs/bootstrap/issues/24093
153-
154-
button {
155-
// stylelint-disable-next-line property-blacklist
156-
border-radius: 0;
157-
}
158-
159-
// Work around a Firefox bug where the transparent button background
160-
// results in a loss of the default button focus styles.
161-
// Credit https://github.com/suitcss/base/
162-
163-
button:focus {
164-
outline: 1px dotted;
165-
outline: 5px auto -webkit-focus-ring-color;
166-
}
167-
168149
// 1. Remove the margin in Firefox and Safari
169150
170151
input,
@@ -185,13 +166,6 @@ export const globalStyles = (theme: EmotionTheme): SerializedStyles => css`
185166
overflow: visible;
186167
}
187168
188-
// Remove the inheritance of text transform in Firefox
189-
190-
button,
191-
select {
192-
text-transform: none;
193-
}
194-
195169
// Set the cursor for all buttons or button-like elements
196170
button,
197171
[role="button"] {
@@ -200,13 +174,6 @@ export const globalStyles = (theme: EmotionTheme): SerializedStyles => css`
200174
}
201175
}
202176
203-
// Remove the inheritance of word-wrap in Safari.
204-
// See https://github.com/twbs/bootstrap/issues/24990
205-
206-
select {
207-
word-wrap: normal;
208-
}
209-
210177
// 1. Prevent a WebKit bug where (2) destroys native audio and video
211178
// controls in Android 4.
212179
// 2. Correct the inability to style clickable types in iOS and Safari.
@@ -219,13 +186,6 @@ export const globalStyles = (theme: EmotionTheme): SerializedStyles => css`
219186
-webkit-appearance: button; // 2
220187
}
221188
222-
// Remove inner border and padding from Firefox, but don't restore the outline like Normalize.
223-
224-
::-moz-focus-inner {
225-
padding: 0;
226-
border-style: none;
227-
}
228-
229189
// Hidden attribute
230190
//
231191
// Always hide an element with the hidden HTML attribute.

0 commit comments

Comments
 (0)