Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions frontends/mit-learn/src/pages/HomePage/HeroSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
} from "@/common/urls"
import { NON_DEGREE_LEARNING_FRAGMENT_IDENTIFIER } from "../AboutPage/AboutPage"
import {
RiAddBoxLine,
RiAwardLine,
RiFileAddLine,
RiSearch2Line,
RiThumbUpLine,
RiTimeLine,
Expand All @@ -34,7 +34,7 @@ const SEARCH_CHIPS: SearchChip[] = [
label: "Recently Added",
href: SEARCH_NEW,
variant: "outlinedWhite",
icon: <RiTimeLine />,
icon: <RiFileAddLine />,
},
{
label: "Popular",
Expand All @@ -46,7 +46,7 @@ const SEARCH_CHIPS: SearchChip[] = [
label: "Upcoming",
href: SEARCH_UPCOMING,
variant: "outlinedWhite",
icon: <RiAddBoxLine />,
icon: <RiTimeLine />,
},
{
label: "Free",
Expand All @@ -63,7 +63,7 @@ const SEARCH_CHIPS: SearchChip[] = [
{
label: "Explore All",
href: "/search/",
variant: "gray",
variant: "outlined",
icon: <RiSearch2Line />,
},
]
Expand Down Expand Up @@ -141,10 +141,31 @@ const TopicLink = styled(Link)({
textDecoration: "underline",
})

const StyledChipLink = styled(ChipLink)(({ theme, variant }) => [
variant === "outlinedWhite" ?? {
const TrendingChip = styled(ChipLink)(({ theme, variant }) => [
{
height: "32px",
padding: "8px 16px",
".MuiChip-icon": {
marginRight: "4px",
},
},
variant === "outlinedWhite" && {
borderColor: theme.custom.colors.lightGray2,
color: theme.custom.colors.silverGrayDark,
"&:hover": {
backgroundColor: `${theme.custom.colors.lightGray1} !important`,
borderColor: `${theme.custom.colors.silverGrayLight} !important`,
color: theme.custom.colors.darkGray2,
},
},
variant === "outlined" && {
backgroundColor: theme.custom.colors.lightGray2,
color: theme.custom.colors.darkGray2,
borderColor: theme.custom.colors.lightGray2,
"&:hover": {
backgroundColor: `${theme.custom.colors.lightGray2} !important`,
borderColor: theme.custom.colors.silverGray,
},
},
])

Expand Down Expand Up @@ -219,7 +240,7 @@ const HeroSearch: React.FC = () => {
</BrowseByTopicContainer>
<TrendingContainer>
{SEARCH_CHIPS.map((chip) => (
<StyledChipLink
<TrendingChip
key={chip.label}
variant={chip.variant}
size="medium"
Expand Down
15 changes: 12 additions & 3 deletions frontends/mit-learn/src/pages/HomePage/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { InputProps } from "ol-components"

const StyledInput = styled(Input)(({ theme }) => ({
height: "72px",
borderRadius: "6px",
boxShadow: "0px 8px 20px 0px rgba(120, 147, 172, 0.10)",
"&.MuiInputBase-adornedEnd": {
paddingRight: "0 !important",
},
Expand Down Expand Up @@ -33,6 +33,15 @@ const StyledAdornmentButton = styled(AdornmentButton)(({ theme }) => ({
},
}))

const StyledClearButton = styled(StyledAdornmentButton)({
".MuiInputBase-sizeHero &": {
width: "32px",
["&:hover"]: {
backgroundColor: "transparent",
},
},
})

export interface SearchSubmissionEvent {
target: {
value: string
Expand Down Expand Up @@ -95,13 +104,13 @@ const SearchInput: React.FC<SearchInputProps> = (props) => {
endAdornment={
<>
{props.value && (
<StyledAdornmentButton
<StyledClearButton
className={props.classNameClear}
aria-label="Clear search text"
onClick={props.onClear}
>
<RiCloseLine />
</StyledAdornmentButton>
</StyledClearButton>
)}
<StyledAdornmentButton
aria-label="Search"
Expand Down