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

fix(style): basic accordion uxpin sync #1313

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
9 changes: 5 additions & 4 deletions packages/react/scripts/buildIconTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const ICONS_WITH_DIRECTIONS = [
'arrow-circle',
'chevron',
'chevron-double',
'triangle'
'triangle',
'triangle-solid'
];
const DIRECTIONS = ['up', 'down', 'left', 'right'];

Expand All @@ -36,7 +37,7 @@ for (const file of files) {

const name = file.replace('.svg', '');
if (ICONS_WITH_DIRECTIONS.includes(name)) {
iconTypes.push(...DIRECTIONS.map(d => `${name}-${d}`));
iconTypes.push(...DIRECTIONS.map((d) => `${name}-${d}`));
} else {
iconTypes.push(name);
}
Expand All @@ -51,11 +52,11 @@ fs.writeFileSync(

/** IconType represents each valid icon type. */
export type IconType =
${iconTypes.map(i => ` | '${i}'`).join('\n')};
${iconTypes.map((i) => ` | '${i}'`).join('\n')};

/** iconTypes holds each valid icon type. */
export const iconTypes = [
${iconTypes.map(i => ` '${i}'`).join(',\n')}
${iconTypes.map((i) => ` '${i}'`).join(',\n')}
];
`.trim()
);
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const Accordion = ({
}

return (
<div className="Accordion" {...props}>
<div className={'Accordion'} {...props}>
orest-s marked this conversation as resolved.
Show resolved Hide resolved
<ExpandCollapsePanel
id={panelElement.props.id || `${elementId}-panel`}
open={open}
Expand All @@ -93,8 +93,8 @@ const Accordion = ({
{...panelElement.props}
>
<PanelTrigger
iconCollapsed="triangle-right"
iconExpanded="triangle-down"
iconCollapsed="triangle-solid-right"
iconExpanded="triangle-solid-down"
scurker marked this conversation as resolved.
Show resolved Hide resolved
className={classnames(
'Accordion__trigger',
(trigger.props as AccordionTriggerProps).className
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 20 additions & 14 deletions packages/styles/accordion.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,67 +3,74 @@
--accordion-trigger-background-color-expanded: var(--white);
--accordion-trigger-text-color: var(--gray-90);
--accordion-trigger-text-color-hover: var(--accent-primary);
--accordion-trigger-box-shadow-hover: var(--accent-primary);
scurker marked this conversation as resolved.
Show resolved Hide resolved
--accordion-trigger-box-shadow-expanded: var(--accent-primary);
--accordion-trigger-border-color: var(--gray-40);
--accordion-trigger-icon-color: var(--gray-90);
--accordion-panel-background-color: var(--white);
--accordion-panel-text-color: var(--gray-90);
--accordion-panel-text-color: var(--gray-80);
--accordion-panel-border-color: var(--gray-40);
--accordion-box-shadow-color: rgba(0, 0, 0, 0.15);
}

.cauldron--theme-dark {
--accordion-trigger-background-color: var(--accent-medium);
--accordion-trigger-background-color-expanded: var(--accent-dark);
--accordion-trigger-text-color: var(--white);
--accordion-trigger-text-color-hover: var(--accent-light);
--accordion-trigger-box-shadow-hover: var(--accent-info);
scurker marked this conversation as resolved.
Show resolved Hide resolved
--accordion-trigger-background-color-expanded: var(--accent-medium);
--accordion-trigger-text-color: var(--accent-light);
--accordion-trigger-text-color-hover: var(--white);
--accordion-trigger-box-shadow-expanded: var(--accent-info);
--accordion-trigger-border-color: var(--stroke-dark);
--accordion-trigger-icon-color: var(--white);
--accordion-panel-background-color: var(--accent-medium);
--accordion-panel-text-color: var(--white);
--accordion-panel-text-color: var(--accent-light);
--accordion-panel-border-color: var(--stroke-dark);
}

.Accordion:has(.Accordion__trigger[aria-expanded='true']) {
filter: drop-shadow(0px 2px 2px rgba(0, 0, 0, 0.15));
scurker marked this conversation as resolved.
Show resolved Hide resolved
}

.Accordion > :is(h1, h2, h3, h4, h5, h6):first-of-type {
all: unset;
}

.Accordion__trigger,
button.Accordion__trigger {
background-color: var(--accordion-trigger-background-color);
padding: calc(var(--space-small) - var(--space-half));
padding: var(--space-small);
width: 100%;
display: flex;
align-items: center;
border-radius: 3px;
border: 1px solid var(--accordion-trigger-border-color);
font-size: var(--text-size-small);
font-weight: var(--font-weight-normal);
margin-top: var(--space-small);
color: var(--accordion-trigger-text-color);
text-decoration: underline solid var(--accordion-trigger-text-color);
}

.Accordion__trigger[aria-expanded='true'] {
box-shadow: inset 5px 0 0 var(--accordion-trigger-box-shadow-expanded);
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
background: var(--accordion-trigger-background-color-expanded);
}

.Accordion__trigger:hover {
box-shadow: inset 8px 0 0 -4px var(--accordion-trigger-box-shadow-hover);
color: var(--accordion-trigger-text-color-hover);
transition: all 0.2s ease-in-out;
text-decoration: underline solid var(--accordion-trigger-text-color-hover);
}

.Accordion__trigger:hover .Icon {
color: var(--accordion-trigger-icon-color);
}

.Accordion .Icon {
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 0.2s;
color: var(--accordion-trigger-icon-color);
}

.Accordion .Icon svg {
height: var(--space-small);
width: var(--space-small);
scurker marked this conversation as resolved.
Show resolved Hide resolved
}

.Accordion__panel {
Expand All @@ -73,5 +80,4 @@ button.Accordion__trigger {
border: 1px solid var(--accordion-panel-border-color);
border-top: 0;
border-radius: 0 0 3px 3px;
box-shadow: 0 2px 3px 0 var(--accordion-box-shadow-color);
}