Skip to content

Commit f85c752

Browse files
3796 fix dependencies modal theme (#3865)
* fix(SearchDependencies): remove important from base search css * fix(SearchDependencies): fix input background, add 'important' to algoia link and logo * fix(Modal): use 'ThemeProvider' from styled-component * fix(SearchDependencies): use dialog foreground and background color from theme * fix(SearchDependencies): fix the highlighted text color
1 parent 7110aa3 commit f85c752

File tree

4 files changed

+52
-29
lines changed

4 files changed

+52
-29
lines changed

packages/app/src/app/pages/Sandbox/SearchDependencies/DependencyHit/elements.js

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,35 @@ import Select from '@codesandbox/common/lib/components/Select';
44
import { UserWithAvatar } from '@codesandbox/common/lib/components/UserWithAvatar';
55
import { GitHubLogo } from 'app/components/GitHubLogo';
66

7-
export const GitHubLogoStyled = styled(GitHubLogo)`
8-
color: ${props =>
9-
!props.theme.light ? 'inherit' : 'rgba(255, 255, 255, 0.8)'};
10-
`;
7+
export const GitHubLogoStyled = styled(GitHubLogo)``;
118

129
const getContainerColor = props => {
1310
if (props.highlighted) {
14-
return Color(props.theme['sideBar.background'])
11+
return Color(props.theme.colors.dialog.background)
1512
.darken(0.2)
1613
.rgbString();
1714
}
1815

19-
return props.theme['sideBar.background'];
16+
return props.theme.colors.dialog.background;
2017
};
2118

2219
export const Container = styled.div`
2320
display: flex;
24-
color: ${props =>
25-
props.theme.light ? 'rgba(0, 0, 0, 1)' : 'rgba(255, 255, 255, 1)'};
21+
color: ${props => props.theme.colors.dialog.foreground};
2622
background-color: ${getContainerColor};
2723
cursor: pointer;
2824
2925
&:not(:last-child) {
3026
border-bottom: 1px solid
3127
${props =>
32-
Color(props.theme['sideBar.background'])
28+
Color(props.theme.colors.dialog.background)
3329
.darken(0.4)
3430
.rgbString()};
3531
}
3632
3733
&:hover {
3834
background-color: ${props =>
39-
Color(props.theme['sideBar.background'])
35+
Color(props.theme.colors.dialog.background)
4036
.darken(0.2)
4137
.rgbString()};
4238
}
@@ -62,7 +58,9 @@ export const Description = styled(Row)`
6258
font-size: 0.875rem;
6359
6460
color: ${props =>
65-
props.theme.light ? 'rgba(0, 0, 0, 0.6)' : 'rgba(255, 255, 255, 0.6)'};
61+
Color(props.theme.colors.dialog.foreground)
62+
.alpha(0.6)
63+
.rgbString()};
6664
`;
6765

6866
export const Downloads = styled.span`
@@ -74,19 +72,31 @@ export const Downloads = styled.span`
7472
export const License = styled.span`
7573
border: 1px solid
7674
${props =>
77-
!props.theme.light ? 'rgba(0, 0, 0, 0.4)' : 'rgba(255, 255, 255, 0.4)'};
75+
Color(props.theme.colors.dialog.border)
76+
.alpha(0.4)
77+
.rgbString()};
7878
border-radius: 3px;
7979
padding: 1px 3px;
8080
8181
color: ${props =>
82-
props.theme.light ? 'rgba(0, 0, 0, 0.6)' : 'rgba(255, 255, 255, 0.6)'};
82+
Color(props.theme.colors.dialog.foreground)
83+
.alpha(0.6)
84+
.rgbString()};
8385
font-size: 12px;
8486
`;
8587

8688
export const IconLink = styled.a`
8789
font-size: 1rem;
8890
color: ${props =>
89-
props.theme.light ? 'rgba(0, 0, 0, 0.8)' : 'rgba(255, 255, 255, 0.8)'};
91+
Color(props.theme.colors.icon.foreground)
92+
.alpha(1)
93+
.rgbString()};
94+
95+
${GitHubLogoStyled} {
96+
circle {
97+
fill: transparent;
98+
}
99+
}
90100
`;
91101

92102
export const StyledSelect = styled(Select)`

packages/app/src/app/pages/Sandbox/SearchDependencies/RawAutoComplete/elements.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import styled from 'styled-components';
2+
import Color from 'color';
23

34
export const AutoCompleteInput = styled.input`
45
width: 100%;
@@ -10,8 +11,7 @@ export const AutoCompleteInput = styled.input`
1011
font-family: inherit;
1112
letter-spacing: 0.45px;
1213
13-
color: ${props =>
14-
props.theme.light ? props.theme.black : props.theme.white};
14+
color: ${props => Color(props.theme.colors.dialog.foreground).rgbString()};
1515
padding: 0.75em 1em;
1616
z-index: 2;
1717
`;
@@ -21,7 +21,9 @@ export const SuggestionInput = styled(AutoCompleteInput)`
2121
top: 0;
2222
left: 0;
2323
color: ${props =>
24-
props.theme.light ? 'rgba(0, 0, 0, 0.3)' : 'rgba(255, 255, 255, 0.3)'};
24+
Color(props.theme.colors.dialog.foreground)
25+
.alpha(0.3)
26+
.rgbString()};
2527
background-color: transparent;
2628
z-index: 1;
2729
pointer-events: none;

packages/app/src/app/pages/Sandbox/SearchDependencies/dependencies.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createGlobalStyle } from 'styled-components';
2+
import Color from 'color';
23

34
export default createGlobalStyle`
45
.ReactModal__Content div[class^='Modal__ModalBody'] {
@@ -22,8 +23,12 @@ export default createGlobalStyle`
2223
}
2324
2425
.ais-Pagination-link {
26+
&:not(.ais-Pagination-link--selected) {
2527
color: ${props =>
26-
props.theme.light ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.5)'};
28+
Color(props.theme.colors.dialog.foreground)
29+
.alpha(0.6)
30+
.rgbString()} !important;
31+
}
2732
}
2833
2934
.ais-Pagination-item--selected {
@@ -32,24 +37,30 @@ export default createGlobalStyle`
3237
}
3338
3439
.ais-Highlight-highlighted {
35-
color: ${props => props.theme['button.hoverBackground']};
40+
color: ${props => props.theme.colors.button.background};
3641
}
3742
38-
.ais-PoweredBy-link svg path:nth-child(4) {
39-
fill: ${props =>
40-
props.theme.light
41-
? 'rgba(0, 0, 0, 0.8)'
42-
: 'rgba(255, 255, 255, 0.8)'} !important;
43+
.ais-PoweredBy-link svg {
44+
fill: ${props =>
45+
Color(props.theme.colors.dialog.foreground)
46+
.alpha(0.8)
47+
.rgbString()} !important;
48+
49+
path:nth-child(4) {
50+
fill: ${props =>
51+
Color(props.theme.colors.dialog.foreground)
52+
.alpha(0.8)
53+
.rgbString()} !important;
54+
}
4355
}
4456
4557
footer {
4658
height: 40px;
4759
background-color: ${props => props.theme['sideBar.background']};
4860
4961
.ais-PoweredBy {
50-
color: ${props =>
51-
props.theme.light ? 'rgba(0, 0, 0, 1)' : 'rgba(255, 255, 255, 1)'};
52-
62+
color: ${props =>
63+
Color(props.theme.colors.dialog.foreground).rgbString()} !important;
5364
}
5465
}
5566
}

packages/app/src/app/pages/Search/search.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,10 @@ const styles = css`
209209
svg {
210210
height: 1.2em;
211211
vertical-align: bottom;
212-
fill: rgba(255, 255, 255, 0.8) !important;
212+
fill: rgba(255, 255, 255, 0.8);
213213
214214
path:nth-child(4) {
215-
fill: rgba(255, 255, 255, 0.8) !important;
215+
fill: rgba(255, 255, 255, 0.8);
216216
}
217217
}
218218
}

0 commit comments

Comments
 (0)