-
Notifications
You must be signed in to change notification settings - Fork 16
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
Moved Accordion to css modules #398
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a1edb90
feat: moved accordion to css modules
hexnickk4997 8a4b4e8
test: fixed issue with css modules
hexnickk4997 c03d5a2
Merge branch 'v4' into feature/ui-831-migrate-accordion
hexnickk4997 0ef83ec
feat: scss -> postcss
hexnickk4997 4f2508e
chore: removed sass dep
hexnickk4997 bccff30
chore: minor refactoring
hexnickk4997 ba1a8b1
feat: removed scss breakpoints
hexnickk4997 8e8a68b
fix: commas
hexnickk4997 84f8821
feat: added classnames
hexnickk4997 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module '*.module.css' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.accordion { | ||
margin: 0 0 var(--lido-space-sm) 0; | ||
background: var(--lido-color-foreground); | ||
border-radius: var(--lido-border-radius-xl); | ||
} | ||
|
||
.summary { | ||
cursor: pointer; | ||
display: flex; | ||
align-items: center; | ||
outline: none; | ||
min-height: 40px; | ||
box-sizing: content-box; | ||
padding: var(--lido-space-lg); | ||
|
||
@media (--lido-media-breakpoint-up-md) { | ||
padding: var(--lido-space-lg) var(--lido-space-xxl); | ||
} | ||
} | ||
|
||
.title { | ||
color: var(--lido-color-text); | ||
flex-grow: 1; | ||
font-weight: 800; | ||
font-size: var(--lido-font-size-xs); | ||
line-height: 1.6em; | ||
} | ||
|
||
.content { | ||
color: var(--lido-color-textSecondary); | ||
font-weight: 400; | ||
font-size: var(--lido-font-size-xxs); | ||
line-height: 1.6em; | ||
padding: var(--lido-space-lg); | ||
padding-top: 0; | ||
|
||
@media (--lido-media-breakpoint-up-md) { | ||
padding: var(--lido-space-xxl); | ||
padding-top: 0; | ||
} | ||
|
||
p, ul, ol { | ||
margin: 0 0 1.6em 0; | ||
|
||
&:last-child { | ||
margin-bottom: 0; | ||
} | ||
} | ||
|
||
ul, ol { | ||
padding: 0 0 0 1.5em; | ||
} | ||
} | ||
|
||
.arrow { | ||
flex-shrink: 0; | ||
margin: -2px; | ||
margin-left: var(--lido-space-md); | ||
fill: var(--lido-color-textSecondary); | ||
} | ||
|
||
.arrowExpanded { | ||
transition: transform var(--lido-transition-duration-norm) ease; | ||
transform: rotate(180deg); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,37 @@ | ||
import React, { ForwardedRef, forwardRef } from 'react' | ||
import { AccordionProps } from './types' | ||
import { | ||
AccordionStyle, | ||
AccordionSummaryStyle, | ||
AccordionTitleStyle, | ||
AccordionArrowStyle, | ||
AccordionContentStyle, | ||
} from './AccordionStyles' | ||
import { ForwardedRef, forwardRef } from 'react' | ||
import { useExpanded } from './useExpanded' | ||
import { NewLidoComponentProps } from 'packages/utils' | ||
import { ArrowBottom } from '../icons' | ||
import styles from './Accordion.module.css' | ||
|
||
function Accordion(props: AccordionProps, ref?: ForwardedRef<HTMLDivElement>) { | ||
const { defaultExpanded, summary, children, ...rest } = props | ||
const { toggleProps, collapseProps, isExpanded } = useExpanded(props) | ||
export type AccordionProps = NewLidoComponentProps< | ||
'div', | ||
{ | ||
defaultExpanded?: boolean | ||
summary: React.ReactNode | ||
} | ||
> | ||
|
||
return ( | ||
<AccordionStyle {...rest} ref={ref}> | ||
<AccordionSummaryStyle {...toggleProps}> | ||
<AccordionTitleStyle>{summary}</AccordionTitleStyle> | ||
<AccordionArrowStyle $expanded={isExpanded} /> | ||
</AccordionSummaryStyle> | ||
<div {...collapseProps}> | ||
<AccordionContentStyle>{children}</AccordionContentStyle> | ||
</div> | ||
</AccordionStyle> | ||
) | ||
} | ||
export const Accordion = forwardRef( | ||
(props: AccordionProps, ref?: ForwardedRef<HTMLDivElement>) => { | ||
const { defaultExpanded, summary, children, ...rest } = props | ||
const { toggleProps, collapseProps, isExpanded } = useExpanded(props) | ||
|
||
export default forwardRef(Accordion) | ||
return ( | ||
<div {...rest} ref={ref} className={styles.accordion}> | ||
<div {...toggleProps} className={styles.summary}> | ||
<div className={styles.title}>{summary}</div> | ||
<ArrowBottom | ||
className={`${styles.arrow} ${ | ||
isExpanded ? styles.arrowExpanded : '' | ||
}`} | ||
/> | ||
</div> | ||
<div {...collapseProps}> | ||
<div className={styles.content}>{children}</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
) | ||
Accordion.displayName = 'Accordion' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export { default as Accordion } from './Accordion' | ||
export * from './types' | ||
export * from './Accordion' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
:root { | ||
--lido-border-radius-xs: 4px; | ||
--lido-border-radius-sm: 6px; | ||
--lido-border-radius-md: 8px; | ||
--lido-border-radius-lg: 10px; | ||
--lido-border-radius-xl: 20px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@custom-media --lido-media-breakpoint-up-sm screen and (min-width: 359px); | ||
@custom-media --lido-media-breakpoint-up-md screen and (min-width: 479px); | ||
@custom-media --lido-media-breakpoint-up-lg screen and (min-width: 767px); | ||
@custom-media --lido-media-breakpoint-up-xl screen and (min-width: 1023px); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
:root { | ||
--lido-color-dark-theme-opacity: 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. commas There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed 👍 |
||
--lido-color-light-theme-opacity: 1, | ||
|
||
--lido-color-light-mode-visibility: visible, | ||
--lido-color-dark-mode-visibility: hidden, | ||
|
||
--lido-color-light-display: initial, | ||
--lido-color-dark-display: none, | ||
|
||
--lido-color-primary: #00a3ff, | ||
--lido-color-primary-hover: #009bf2, | ||
--lido-color-primary-contrast: #fff, | ||
--lido-color-primary-visited: #4bbeff, | ||
|
||
--lido-color-accent: #27272e, | ||
--lido-color-accent-contrast: #fff, | ||
--lido-color-accent-contrast-secondary: rgba(255, 255, 255, 0.6), | ||
--lido-color-accent-darken: rgba(0, 0, 0, .2), | ||
--lido-color-accent-control-bg: rgba(0, 0, 0, .1), | ||
--lido-color-accent-border: rgba(255, 255, 255, 0.2), | ||
--lido-color-accent-border-hover: rgba(255, 255, 255, 0.3), | ||
|
||
--lido-color-error: #e14d4d, | ||
--lido-color-error-hover: #d44c4d, | ||
--lido-color-error-contrast: #fff, | ||
|
||
--lido-color-warning: #EC8600, | ||
--lido-color-warning-hover: #f0a431, | ||
--lido-color-warning-contrast: #fff, | ||
--lido-color-warning-background: #FFFAE0, | ||
|
||
--lido-color-text-dark: #273852, | ||
|
||
--lido-color-success: #53BA95, | ||
--lido-color-success-hover: #4ba886, | ||
--lido-color-success-contrast: #fff, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@import './borders.css'; | ||
@import './breakpoints.css'; | ||
@import './colors.css'; | ||
@import './shadows.css'; | ||
@import './spacing.css'; | ||
@import './transitions.css'; | ||
@import './typography.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
:root { | ||
--lido-shadows-xxl: 0px 8px 44px 0px; | ||
--lido-shadows-xl: 0px 8px 32px 0px; | ||
--lido-shadows-lg: 0px 8px 24px 0px; | ||
--lido-shadows-md: 0px 4px 16px 0px; | ||
--lido-shadows-sm: 0px 4px 12px 0px; | ||
--lido-shadows-xs: 0px 4px 8px 0px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
:root { | ||
--lido-space-xs: 4px; | ||
--lido-space-sm: 8px; | ||
--lido-space-md: 16px; | ||
--lido-space-lg: 20px; | ||
--lido-space-xl: 24px; | ||
--lido-space-xxl: 32px; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with
classnames
it will look likecn(styles.arrow, {[styles.arrowExpanded]: isExpanded})
, consider bringing it to the project (it will be useful anyway)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, added