Skip to content

Ada iconography consistency #1408

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

Merged
merged 21 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
117c1ac
Adjust `ascent-override` on Ada poppins font to correctly center text
jacbn Apr 15, 2025
6f76f85
Add basic support for shared `<i/>`-cons across both sites
jacbn Apr 15, 2025
9e5112c
Remove Ada icon offset
jacbn Apr 15, 2025
4973c40
Manually shrink Ada icons to shared 16px default
jacbn Apr 15, 2025
6107173
Split out QF-style search input to own component for reuse
jacbn Apr 15, 2025
7ab92e7
Stabilise button padding after text fix
jacbn Apr 15, 2025
3168825
Further increase ascent override on Poppins fonts
jacbn Apr 16, 2025
41f85bc
Merge branch 'redesign-2024' into redesign/ada-consistency
jacbn Apr 28, 2025
e05cbe1
Move shared iconography code to `/common/icons`
jacbn Apr 28, 2025
18241d2
Remove React component from `ts` import to fix tests
jacbn Apr 28, 2025
661f9e8
Improve Poppins fix once again
jacbn Apr 28, 2025
3c1952d
Merge remote-tracking branch 'origin/redesign-2024' into redesign/ada…
jacbn Apr 29, 2025
55cd478
Adjust Poppins descent override to shift text up slightly
jacbn Apr 29, 2025
73620f8
Update VRT baselines
actions-user Apr 29, 2025
c4ed3bd
Merge pull request #1409 from isaacphysics/vrt/redesign/ada-consistency
jacbn May 6, 2025
c59659e
Merge branch 'redesign-2024' into redesign/ada-consistency
jacbn May 6, 2025
dbd9f0d
Update VRT baselines
actions-user May 6, 2025
1e64972
Merge pull request #1423 from isaacphysics/vrt/redesign/ada-consistency
jacbn May 6, 2025
8c34083
Merge branch 'redesign-2024' into redesign/ada-consistency
sjd210 May 7, 2025
b80ec66
Update VRT baselines
actions-user May 7, 2025
216e92b
Merge pull request #1425 from isaacphysics/vrt/redesign/ada-consistency
sjd210 May 7, 2025
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
3 changes: 3 additions & 0 deletions public/assets/common/icons/arrow-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/common/icons/download.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 22 additions & 2 deletions src/app/components/elements/SearchInputs.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {ChangeEvent} from "react";
import {Button, Input, InputGroup, Label} from "reactstrap";
import {siteSpecific, withSearch} from "../../services";
import {Button, Input, InputGroup, InputProps, Label} from "reactstrap";
import {ifKeyIsEnter, SEARCH_CHAR_LENGTH_LIMIT, siteSpecific, withSearch} from "../../services";

const PhysicsSearchButton = () => (
<Button color='link' aria-label='search' className='search-button'>
Expand Down Expand Up @@ -108,3 +108,23 @@

export const SearchPageSearch = siteSpecific(PhySimpleSearch, AdaHeaderSearch);
export const MainSearchInput = siteSpecific(PhySearchInput, AdaSearchInput);


interface SearchButtonWithIconProps extends InputProps {
onSearch?: () => void;
}

export const SearchInputWithIcon = (props: SearchButtonWithIconProps) => {
const {onSearch, ...rest} = props;
return <InputGroup className="search-input-icon">
<Input {...rest}
id="question-search-title"
type="text"
maxLength={SEARCH_CHAR_LENGTH_LIMIT}
{...(onSearch ? {"onKeyDown": ifKeyIsEnter(onSearch)} : {})}
/>
<button className="d-flex align-items-center justify-content-center" onClick={onSearch} aria-label="Search">
<i className="icon icon-search" color="tertiary"/>
</button>
</InputGroup>;
}
25 changes: 11 additions & 14 deletions src/app/components/pages/QuestionFinder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {MetaDescription} from "../elements/MetaDescription";
import {CanonicalHrefElement} from "../navigation/CanonicalHrefElement";
import classNames from "classnames";
import queryString from "query-string";
import {Button, Card, CardBody, CardHeader, Col, Container, Input, InputGroup, Label, Row} from "reactstrap";
import {Button, Card, CardBody, CardHeader, Col, Container, Label, Row} from "reactstrap";
import {ChoiceTree, getChoiceTreeLeaves, QuestionFinderFilterPanel} from "../elements/panels/QuestionFinderFilterPanel";
import {TierID} from "../elements/svg/HierarchyFilter";
import { MainContent, QuestionFinderSidebar, SidebarLayout } from "../elements/layout/SidebarLayout";
Expand All @@ -54,6 +54,7 @@ import { ContentTypeVisibility, LinkToContentSummaryList } from "../elements/lis
import { PageFragment } from "../elements/PageFragment";
import { RenderNothing } from "../elements/RenderNothing";
import { processTagHierarchy, pruneTreeNode } from "../../services/questionHierarchy";
import { SearchInputWithIcon } from "../elements/SearchInputs";

// Type is used to ensure that we check all query params if a new one is added in the future
const FILTER_PARAMS = ["query", "topics", "fields", "subjects", "stages", "difficulties", "examBoards", "book", "excludeBooks", "statuses", "randomSeed"] as const;
Expand Down Expand Up @@ -498,19 +499,15 @@ export const QuestionFinder = withRouter(({location}: RouteComponentProps) => {
{isAda && <Row>
<Col lg={6} md={12} xs={12} className="finder-search">
<Label htmlFor="question-search-title" className="mt-2"><b>Search for a question</b></Label>
<InputGroup>
<Input id="question-search-title"
type="text"
maxLength={SEARCH_CHAR_LENGTH_LIMIT}
defaultValue={searchQuery}
placeholder={siteSpecific(`e.g. ${getQuestionPlaceholder(pageContext)}`, "e.g. Creating an AST")}
onChange={(e) => {
debouncedSearchHandler(e.target.value);
setRandomSeed(undefined); // This random seed reset is for Ada only! This is managed in the filtersChanged useEffect for Phy
}}
/>
<Button className="question-search-button" onClick={searchAndUpdateURL}/>
</InputGroup>
<SearchInputWithIcon
defaultValue={searchQuery}
placeholder={siteSpecific(`e.g. ${getQuestionPlaceholder(pageContext)}`, "e.g. Creating an AST")}
onChange={(e) => {
debouncedSearchHandler(e.target.value);
setRandomSeed(undefined); // This random seed reset is for Ada only! This is managed in the filtersChanged useEffect for Phy
}}
onSearch={searchAndUpdateURL}
/>
</Col>
</Row>}

Expand Down
6 changes: 3 additions & 3 deletions src/scss/common/elements.scss
Original file line number Diff line number Diff line change
Expand Up @@ -381,17 +381,17 @@ iframe.email-html {
transition: background-position 0.3s ease-in-out;

&:has(> input:checked) {
border-left: solid 2px var(--sidebar-tab-active);
border-left: solid 2px var(--tab-active);
background-position: 0% 0%;

.badge.rounded-pill {
background-color: var(--sidebar-tab-active);
background-color: var(--tab-active);
color: white;
}
}

&:hover:not(:has(> input:checked, > input:disabled)) {
border-left: solid 2px var(--sidebar-tab-hover);
border-left: solid 2px var(--tab-hover);
}

&:has(> input:disabled) {
Expand Down
77 changes: 77 additions & 0 deletions src/scss/common/icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,80 @@ polygon.fill-secondary {
img[aria-disabled="true"] {
opacity: 0.5;
}

.icon-download {
@include svg-icon('/assets/common/icons/download.svg', var(--icon-size), var(--icon-size), var(--mask-size, 60%));
}

.icon-chevron-right {
@include svg-icon('/assets/common/icons/arrow-right.svg', var(--icon-size), var(--icon-size), var(--mask-size, 60%));
}

.icon-search {
@include svg-icon('/assets/common/icons/search-icon.svg', var(--icon-size), var(--icon-size), var(--mask-size, 60%));
}

// Icon sizing
.icon {
--icon-size: 16px;
--mask-size: 100%;
}

.icon-lg {
--icon-size: 60px;
--mask-size: initial;
}

.icon-xl {
--icon-size: 75px;
--mask-size: initial;
}

@mixin icon-color-override($color) {
&.layered {
&::before {
background-color: $color !important;
}
&::after {
background-color: $color !important;
}
}

// .layered is a bit grim; if we could set something in @svg-icon-layered as a flag instead this would be ideal.
&:not(.layered) {
background-color: $color !important;
}
}

i.icon {
&, &[color="primary"] {
background-color: var(--icon-primary);

@include not-reduced-motion {
transition: background-color 0.15s ease-in-out; // mirrors BS's $btn-transition
}

// for layered icons, the ::after element takes the colour while the ::before remains uncoloured
&::after {
background-color: var(--icon-primary);

@include not-reduced-motion {
transition: background-color 0.15s ease-in-out;
}
}
}

&[color="secondary"] {
background-color: var(--icon-secondary);
&::after {
background-color: var(--icon-secondary);
}
}

&[color="tertiary"] {
background-color: var(--icon-tertiary);
&::after {
background-color: var(--icon-tertiary);
}
}
}
34 changes: 34 additions & 0 deletions src/scss/common/search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,37 @@ nav.search {
flex-flow: row nowrap;
max-width: 520px;
}

.search-input-icon {
$search-button-offset: 50px;
> input {
border-right: none;
}

> button {
// background: white url(/assets/cs/icons/search-jet.svg) no-repeat center;
// background-size: 20px 20px;
background-color: white;
border: 1px solid black;
border-left: none;
border-radius: 0 $border-radius-lg $border-radius-lg 0;
padding: 0;
width: $search-button-offset;
min-width: 0;
&:active {
background-color: lightgray !important;
}
}

&::after {
content: "";
display: block;
position: absolute;
width: 1px;
height: 75%;
top: 12.5%;
right: $search-button-offset;
background: #c2c2c2;
z-index: 4;
}
}
2 changes: 1 addition & 1 deletion src/scss/common/tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
&.active {
.nav-link {
font-family: $secondary-font-semi-bold;
background-color: var(--sidebar-tab-active, $black);
background-color: var(--tab-active, $black);
color: $white;
text-decoration: none;
cursor: default;
Expand Down
4 changes: 2 additions & 2 deletions src/scss/cs/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@

font-size: 1.111rem;
&:not(.btn-sm):not(.btn-link) {
padding: 0.5rem 2.1rem 0.4rem 2.1rem;
padding: 0.5rem 2.1rem;
}
@extend .fw-semi-bold;
&.btn-sm {
padding: 0.2rem 0.7rem 0.16rem 0.7rem;
padding: 0.2rem 0.7rem;
}
min-width: 25px;

Expand Down
14 changes: 14 additions & 0 deletions src/scss/cs/color-theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// TODO:
// - move any colour theming from /cs/isaac.scss here
// - (including all colour definitions)
// - copy any required theming from phy/isaac.scss
// - ensure all variables are named equivalently across the two files

#root {
--tab-active: #{$dark-pink-300};
--tab-hover: #{$cs-light-gray};

--icon-primary: #{$dark-pink-300};
--icon-secondary: #{$cyan-100};
--icon-tertiary: #{$cs-black};
}
8 changes: 8 additions & 0 deletions src/scss/cs/fonts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
src: url('/assets/cs/fonts/poppins-bold.woff2') format('woff2'),
url('/assets/cs/fonts/poppins-bold.woff') format('woff'),
url('/assets/cs/fonts/poppins-bold.ttf') format('truetype');
ascent-override: 140%;
}

@font-face {
Expand All @@ -22,6 +23,7 @@
src: url('/assets/cs/fonts/poppins-bolditalic.woff2') format('woff2'),
url('/assets/cs/fonts/poppins-bolditalic.woff') format('woff'),
url('/assets/cs/fonts/poppins-bolditalic.ttf') format('truetype');
ascent-override: 140%;
}

@font-face {
Expand All @@ -31,6 +33,7 @@
src: url('/assets/cs/fonts/poppins-italic.woff2') format('woff2'),
url('/assets/cs/fonts/poppins-italic.woff') format('woff'),
url('/assets/cs/fonts/poppins-italic.ttf') format('truetype');
ascent-override: 140%;
}

@font-face {
Expand All @@ -40,6 +43,7 @@
src: url('/assets/cs/fonts/poppins-light.woff2') format('woff2'),
url('/assets/cs/fonts/poppins-light.woff') format('woff'),
url('/assets/cs/fonts/poppins-light.ttf') format('truetype');
ascent-override: 140%;
}

@font-face {
Expand All @@ -49,6 +53,7 @@
src: url('/assets/cs/fonts/poppins-lightitalic.woff2') format('woff2'),
url('/assets/cs/fonts/poppins-lightitalic.woff') format('woff'),
url('/assets/cs/fonts/poppins-lightitalic.ttf') format('truetype');
ascent-override: 140%;
}

@font-face {
Expand All @@ -58,6 +63,7 @@
src: url('/assets/cs/fonts/poppins-regular.woff2') format('woff2'),
url('/assets/cs/fonts/poppins-regular.woff') format('woff'),
url('/assets/cs/fonts/poppins-regular.ttf') format('truetype');
ascent-override: 140%;
}

@font-face {
Expand All @@ -67,6 +73,7 @@
src: url('/assets/cs/fonts/poppins-semibold.woff2') format('woff2'),
url('/assets/cs/fonts/poppins-semibold.woff') format('woff'),
url('/assets/cs/fonts/poppins-semibold.ttf') format('truetype');
ascent-override: 140%;
}

@font-face {
Expand All @@ -76,6 +83,7 @@
src: url('/assets/cs/fonts/poppins-semibolditalic.woff2') format('woff2'),
url('/assets/cs/fonts/poppins-semibolditalic.woff') format('woff'),
url('/assets/cs/fonts/poppins-semibolditalic.ttf') format('truetype');
ascent-override: 140%;
}

@font-face {
Expand Down
1 change: 1 addition & 0 deletions src/scss/cs/isaac.scss
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ $enable-negative-margins: true;

// Theming
@import "../common/accessibility";
@import "color-theme";

// Atoms
@import "fonts";
Expand Down
8 changes: 4 additions & 4 deletions src/scss/phy/color-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
// NAVIGATION
--nav-primary: #{map.get($subject-colors, 500)};
--nav-secondary: #{map.get($subject-colors, 400)};
--sidebar-tab-active: #{map.get($subject-colors, 500)};
--sidebar-tab-hover: #{map.get($subject-colors, 300)};
--tab-active: #{map.get($subject-colors, 500)};
--tab-hover: #{map.get($subject-colors, 300)};

// ICONS
--icon-primary: #{map.get($subject-colors, 500)};
Expand Down Expand Up @@ -75,8 +75,8 @@
--buttons-light-hover-prefix: #{$color-neutral-200};

--nav-primary: #{$color-brand-500};
--sidebar-tab-active: #{$color-brand-500};
--sidebar-tab-hover: #{$color-neutral-300};
--tab-active: #{$color-brand-500};
--tab-hover: #{$color-neutral-300};

--icon-primary: #{$color-brand-500};

Expand Down
Loading
Loading