Skip to content

Commit

Permalink
Rename unselectedBackground to alternateBackground
Browse files Browse the repository at this point in the history
This color is now used for more than just the unselected background.
  • Loading branch information
victorlin committed Nov 13, 2023
1 parent e441dae commit 1ad4376
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
34 changes: 18 additions & 16 deletions docs/customise-client/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,27 @@ For instance, here is the customisation used by nextstrain.org:
"font-family": "Lato, Helvetica Neue, Helvetica, sans-serif",
"selectedColor": "#5097BA",
"unselectedColor": "#333",
"unselectedBackground": "#888"
"alternateBackground": "#888"
}
}
+--------------------------+------------------------------+----------------------------------------------------+
| Properties | CSS string of | Description |
+==========================+==============================+====================================================+
| selectedColor | color | Text color of selected text / button text |
+--------------------------+------------------------------+----------------------------------------------------+
| unselectedColor | color | Text color of unselected text / button text |
+--------------------------+------------------------------+----------------------------------------------------+
| color | color | Text color of all other text |
+--------------------------+------------------------------+----------------------------------------------------+
| unselectedBackground | color | Background color of unselected toggle |
+--------------------------+------------------------------+----------------------------------------------------+
| font-family | font | Font used throughout the sidebar |
+--------------------------+------------------------------+----------------------------------------------------+
| background | color | Background color of the entire sidebar |
+--------------------------+------------------------------+----------------------------------------------------+
+-----------------------------------+---------------+------------------------------------------------------------------------------+
| Properties | CSS string of | Description |
+===================================+===============+==============================================================================+
| selectedColor | color | Text color of selected text / button text |
+-----------------------------------+---------------+------------------------------------------------------------------------------+
| unselectedColor | color | Text color of unselected text / button text |
+-----------------------------------+---------------+------------------------------------------------------------------------------+
| color | color | Text color of all other text |
+-----------------------------------+---------------+------------------------------------------------------------------------------+
| unselectedBackground (deprecated) | color | Old key for ``alternateBackground`` |
+-----------------------------------+---------------+------------------------------------------------------------------------------+
| alternateBackground | color | Background color of some elements (unselected toggle, panel section borders) |
+-----------------------------------+---------------+------------------------------------------------------------------------------+
| font-family | font | Font used throughout the sidebar |
+-----------------------------------+---------------+------------------------------------------------------------------------------+
| background | color | Background color of the entire sidebar |
+-----------------------------------+---------------+------------------------------------------------------------------------------+

Components
----------
Expand Down
6 changes: 2 additions & 4 deletions src/components/controls/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ export const PanelSectionContainer = styled.div`
padding-bottom: 8px;
// Add borders to delineate panel sections from other sections.
// TODO: Rename unselectedBackground to alternateBackground.
// https://github.com/nextstrain/auspice/pull/1704#discussion_r1385917481
border-top: 1px solid ${(props) => props.theme.unselectedBackground};
border-bottom: 1px solid ${(props) => props.theme.unselectedBackground};
border-top: 1px solid ${(props) => props.theme.alternateBackground};
border-bottom: 1px solid ${(props) => props.theme.alternateBackground};
// Don't add a top border when there is already a bottom border from a sibling
// above.
Expand Down
2 changes: 1 addition & 1 deletion src/components/controls/toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Slider = styled.div`
left: 0;
right: 0;
bottom: 0;
background-color: ${(props) => props.theme.unselectedBackground};
background-color: ${(props) => props.theme.alternateBackground};
-webkit-transition: .4s;
transition: .4s;
border-radius: 12px;
Expand Down
7 changes: 6 additions & 1 deletion src/components/main/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ const sidebarThemeDefaults = {
sidebarBoxShadow: "rgba(255, 255, 255, 1)",
selectedColor: "#5DA8A3",
unselectedColor: "#BBB",
unselectedBackground: "#888"
alternateBackground: "#888"
};
let sidebarThemeExtensions = {};
if (hasExtension("sidebarTheme")) {
sidebarThemeExtensions = getExtension("sidebarTheme");

// unselectedBackground → alternateBackground
if (Object.prototype.hasOwnProperty.call(sidebarThemeExtensions, "unselectedBackground")) {
sidebarThemeExtensions["alternateBackground"] = sidebarThemeExtensions["unselectedBackground"];
}
}
export const sidebarTheme = {...sidebarThemeDefaults, ...sidebarThemeExtensions};

0 comments on commit 1ad4376

Please sign in to comment.