Skip to content
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

BREAKING CHANGE: Dark mode support #902

Merged
merged 17 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"browser": true
},
"rules": {
"react/require-default-props": ["error", { "ignoreFunctionalComponents": true }],
"arrow-parens": [
"error",
"as-needed"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
fetch-depth: 0 # Required to retrieve git history
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: 16
- uses: actions/cache@v1
with:
path: ~/.cache/yarn
Expand Down
1 change: 0 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ module.exports = {
'storybook-addon-designs',
'storybook-addon-mdx-embed',
'@storybook/addon-postcss',
'./register',
],
webpackFinal: config => {
const mdxRule = config.module.rules.find((rule) =>
Expand Down
3 changes: 2 additions & 1 deletion .storybook/preview-body.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<style>
body {
padding: 2rem;
color: #3C453E;
color: var(--color-text-body-primary);
background-color: var(--color-background-secondary);
}
</style>
9 changes: 7 additions & 2 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ export const parameters = {
'Foundation',
['Design Principles', 'Design Tokens'],
'Content',
['Goals and Principles', 'Voice and Tone', 'Grammar and Mechanics', 'Word List'],
[
'Goals and Principles',
'Voice and Tone',
'Grammar and Mechanics',
'Word List',
],
'Theming',
['Overview', 'Form Controls'],
['Overview'],
'Components',
'Patterns',
],
Expand Down
11 changes: 0 additions & 11 deletions .storybook/register.js

This file was deleted.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"dependencies": {
"@palmetto/dialog": "^0.16.4",
"@palmetto/palmetto-design-tokens": "0.79.2",
"@palmetto/palmetto-design-tokens": "1.7.2",
"@popperjs/core": "^2.5.3",
"classnames": "^2.2.6",
"cleave.js": "^1.6.0",
Expand Down Expand Up @@ -85,7 +85,6 @@
"@babel/plugin-transform-spread": "^7.13.0",
"@babel/polyfill": "^7.10.4",
"@babel/preset-react": "^7.10.4",
"@fullstory/browser": "^1.4.9",
"@mdx-js/loader": "^1.6.22",
"@semantic-release/changelog": "5",
"@semantic-release/commit-analyzer": "^8.0.1",
Expand Down
92 changes: 51 additions & 41 deletions src/components/Accordion/Accordion.Overview.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,18 @@ Accordions are useful when you want to toggle between hiding and showing additio
</Accordion.PanelSummary>
<Accordion.PanelDetails gap="md">
<p>
Solar panels, also called photovoltaic or PV panels, consist of solar cells that are
designed to capture the radiant light and heat contained in sunlight and convert it
into usable clean energy for your home.
Solar panels, also called photovoltaic or PV panels, consist of
solar cells that are designed to capture the radiant light and
heat contained in sunlight and convert it into usable clean
energy for your home.
</p>
<p>
When sunlight hits your solar panel, the photons of energy are converted into DC
(direct current) electricity, which is then converted into AC (alternating current)
electricity for use in your home. Solar panels are often grouped together to form a
solar grid or solar array, allowing you to capture and harness the right amount of
energy for your needs.
When sunlight hits your solar panel, the photons of energy are
converted into DC (direct current) electricity, which is then
converted into AC (alternating current) electricity for use in
your home. Solar panels are often grouped together to form a
solar grid or solar array, allowing you to capture and harness
the right amount of energy for your needs.
</p>
</Accordion.PanelDetails>
</Accordion.Panel>
Expand All @@ -74,14 +76,16 @@ Accordions are useful when you want to toggle between hiding and showing additio
</Accordion.PanelSummary>
<Accordion.PanelDetails>
<p>
There are several factors we can look at to determine if solar might be a good
solution for your needs, including roof space, home energy usage, credit health, and
eligibility for incentives. At Palmetto, we start by calculating a quick savings
estimate based on your home, location, and current utility costs. Then, we’ll
schedule a meeting to clarify your goals, address any questions, identify purchase
options, and outline the solar process. All of this happens before you pay, allowing
you to decide if a solar power system is right for you based on a complete
understanding of the potential costs and savings.
There are several factors we can look at to determine if solar
might be a good solution for your needs, including roof space,
home energy usage, credit health, and eligibility for
incentives. At Palmetto, we start by calculating a quick savings
estimate based on your home, location, and current utility
costs. Then, we’ll schedule a meeting to clarify your goals,
address any questions, identify purchase options, and outline
the solar process. All of this happens before you pay, allowing
you to decide if a solar power system is right for you based on
a complete understanding of the potential costs and savings.
</p>
</Accordion.PanelDetails>
</Accordion.Panel>
Expand All @@ -94,13 +98,15 @@ Accordions are useful when you want to toggle between hiding and showing additio
</Accordion.PanelSummary>
<Accordion.PanelDetails>
<p>
The right solar power system for your home will depend on a variety of factors,
including your current energy usage, the size and layout of your roof, and your
preferred level of energy independence. To hone in on the right solution for your
home, we always begin with a personal consultation and a survey, both of which serve
to clarify your goals and outline available options. Should you choose to invest,
we’ll design a custom solution to meet your goals and maximize your savings—no
haggling, no upselling, just right.
The right solar power system for your home will depend on a
variety of factors, including your current energy usage, the
size and layout of your roof, and your preferred level of energy
independence. To hone in on the right solution for your home, we
always begin with a personal consultation and a survey, both of
which serve to clarify your goals and outline available options.
Should you choose to invest, we’ll design a custom solution to
meet your goals and maximize your savings—no haggling, no
upselling, just right.
</p>
</Accordion.PanelDetails>
</Accordion.Panel>
Expand Down Expand Up @@ -153,9 +159,10 @@ By default the caret is on the right. You can render the caret on the left side
</Accordion.PanelSummary>
<Accordion.PanelDetails>
<p>
Together, we’ll clarify your goals, address any questions, identify purchase options
and incentives, and outline the solar process—placing you in the driver’s seat for
everything moving forward.
Together, we’ll clarify your goals, address any questions,
identify purchase options and incentives, and outline the solar
process—placing you in the driver’s seat for everything moving
forward.
</p>
</Accordion.PanelDetails>
</Accordion.Panel>
Expand All @@ -169,9 +176,9 @@ By default the caret is on the right. You can render the caret on the left side
</Accordion.PanelSummary>
<Accordion.PanelDetails>
<p>
Our solar specialists will take a survey of your property and define specific
requirements in your area. Then, we’ll design a solar energy system to maximize your
savings.
Our solar specialists will take a survey of your property and
define specific requirements in your area. Then, we’ll design a
solar energy system to maximize your savings.
</p>
</Accordion.PanelDetails>
</Accordion.Panel>
Expand All @@ -185,9 +192,10 @@ By default the caret is on the right. You can render the caret on the left side
</Accordion.PanelSummary>
<Accordion.PanelDetails>
<p>
We work on your behalf to navigate state and municipal requirements, homeowners
associations, and utility paperwork—moving your project from design to install with
the ultimate efficiency.
We work on your behalf to navigate state and municipal
requirements, homeowners associations, and utility
paperwork—moving your project from design to install with the
ultimate efficiency.
</p>
</Accordion.PanelDetails>
</Accordion.Panel>
Expand Down Expand Up @@ -236,9 +244,10 @@ You can also choose to hide the caret altogether. Moreover, the accordion is a v
</Accordion.PanelSummary>
<Accordion.PanelDetails>
<p>
Together, we’ll clarify your goals, address any questions, identify purchase options
and incentives, and outline the solar process—placing you in the driver’s seat for
everything moving forward.
Together, we’ll clarify your goals, address any questions,
identify purchase options and incentives, and outline the solar
process—placing you in the driver’s seat for everything moving
forward.
</p>
</Accordion.PanelDetails>
</Accordion.Panel>
Expand All @@ -252,9 +261,9 @@ You can also choose to hide the caret altogether. Moreover, the accordion is a v
</Accordion.PanelSummary>
<Accordion.PanelDetails>
<p>
Our solar specialists will take a survey of your property and define specific
requirements in your area. Then, we’ll design a solar energy system to maximize your
savings.
Our solar specialists will take a survey of your property and
define specific requirements in your area. Then, we’ll design a
solar energy system to maximize your savings.
</p>
</Accordion.PanelDetails>
</Accordion.Panel>
Expand All @@ -268,9 +277,10 @@ You can also choose to hide the caret altogether. Moreover, the accordion is a v
</Accordion.PanelSummary>
<Accordion.PanelDetails>
<p>
We work on your behalf to navigate state and municipal requirements, homeowners
associations, and utility paperwork—moving your project from design to install with
the ultimate efficiency.
We work on your behalf to navigate state and municipal
requirements, homeowners associations, and utility
paperwork—moving your project from design to install with the
ultimate efficiency.
</p>
</Accordion.PanelDetails>
</Accordion.Panel>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Accordion/AccordionPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type AccordionPanelProps = DetailsProps;
export const AccordionPanel: React.FC<AccordionPanelProps> = ({
children,
borderWidth = '0 0 xs 0',
borderColor = 'grey-100',
borderColor = 'separator',
...restProps
}) => (
<Details {...restProps} borderColor={borderColor} borderWidth={borderWidth}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Accordion/AccordionPanelSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const AccordionPanelSummary: React.FC<AccordionPanelSummaryProps> = ({
<Box>
<Icon
name={isDetailsOpen ? 'caret-sm-down' : 'caret-sm-right'}
color="grey-500"
color="body-secondary"
/>
</Box>
)}
Expand All @@ -39,7 +39,7 @@ export const AccordionPanelSummary: React.FC<AccordionPanelSummaryProps> = ({
<Box margin="0 0 0 auto">
<Icon
name={isDetailsOpen ? 'caret-sm-up' : 'caret-sm-down'}
color="grey-500"
color="body-secondary"
/>
</Box>
)}
Expand Down
99 changes: 0 additions & 99 deletions src/components/Alert/Alert.Overview.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -186,102 +186,3 @@ Renders a version of the banner with less padding.
;
</Story>
</Canvas>

## Custom Theme

The Alert component can be themed by base tokens, or component specific tokens.

<Canvas>
<Story name="With Custom Theme">
<>
<div
style={{
'--color-brand-info-50': '#CFC5E9',
'--color-brand-info-500': '#603FB5',
'--alert-border-width': '0',
}}
>
<Alert
message="Here we've overwritten base token values so that the alert inherits new values."
title="Custom Theme"
variant="info"
hasIcon
className="m-bottom-md"
/>
</div>
<div
style={{
'--alert-info-font-color': '#603FB5',
'--alert-info-background-color': 'white',
'--alert-info-icon-color': '#603FB5',
'--alert-border-width': 'var(--size-border-xs)',
'--alert-info-border-color': 'var(--alert-info-icon-color)',
}}
>
<Alert
message="Here we've overwritten ONLY the values for the 'info' alert variant so other components will be unaffected"
title="Custom Theme"
variant="info"
hasIcon
className="m-bottom-md"
/>
<Alert
message="An alert that uses default token values"
variant="warning"
title="Not Themed"
hasIcon
/>
</div>
</>
</Story>
</Canvas>

## Component Design Tokens

<table>
<thead>
<tr>
<th>token name</th>
<th>default value</th>
</tr>
</thead>
<tbody>
{(() => {
const tokens = {
'--alert-default-background-color': '--color-brand-grey-100',
'--alert-default-font-color': '--color-brand-grey-600',
'--alert-default-icon-color': '--color-brand-grey-600',
'--alert-default-border-color': '--color-brand-grey-200',
'--alert-info-background-color': '--color-brand-info-50',
'--alert-info-font-color': '--color-brand-grey-600',
'--alert-info-icon-color': '--color-brand-info-500',
'--alert-info-border-color': '--color-brand-info-200',
'--alert-success-background-color': '--color-brand-success-50',
'--alert-success-font-color': '--color-brand-grey-600',
'--alert-success-icon-color': '--color-brand-success-500',
'--alert-success-border-color': '--color-brand-success-200',
'--alert-warning-background-color': '--color-brand-warning-50',
'--alert-warning-font-color': '--color-brand-grey-600',
'--alert-warning-icon-color': '--color-brand-warning-500',
'--alert-warning-border-color': '--color-brand-warning-200',
'--alert-danger-background-color': '--color-brand-danger-50',
'--alert-danger-font-color': '--color-brand-grey-600',
'--alert-danger-icon-color': '--color-brand-danger-500',
'--alert-danger-border-color': '--color-brand-danger-200',
'--alert-border-width': '--size-border-xs',
'--alert-border-color': 'transparent',
'--alert-box-shadow': '--size-box-shadow-0',
};
return Object.entries(tokens).map(([name, entry], i) => (
<tr key={i}>
<td>
<code>{name}</code>
</td>
<td>
<code>{entry}</code>
</td>
</tr>
));
})()}
</tbody>
</table>
Loading
Loading