forked from awslabs/data-on-eks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Website updates for collapsible content (awslabs#296)
- Loading branch information
1 parent
39e790c
commit 38a19d8
Showing
13 changed files
with
141 additions
and
77 deletions.
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
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 |
---|---|---|
|
@@ -44,4 +44,4 @@ singleuser: | |
CHOWN_EXTRA: "/home/shared" | ||
uid: 0 | ||
fsGid: 0 | ||
cmd: "start-singleuser.sh" | ||
cmd: "start-singleuser.sh" |
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
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,31 @@ | ||
import React, {useState} from 'react'; | ||
import React, { useState } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import clsx from 'clsx'; | ||
import styles from './CollapsibleContent.module.css'; | ||
|
||
function CollapsibleContent({children, header}) { | ||
const [isExpanded, setIsExpanded] = useState(false); | ||
function CollapsibleContent({ children, header }) { | ||
const [isExpanded, setIsExpanded] = useState(false); | ||
|
||
const toggleExpansion = () => { | ||
setIsExpanded(!isExpanded); | ||
}; | ||
const toggleExpansion = () => { | ||
setIsExpanded(!isExpanded); | ||
}; | ||
|
||
return ( | ||
<div className={styles.collapsibleContent}> | ||
<div className={clsx(styles.header, {[styles.expanded]: isExpanded})} onClick={toggleExpansion}> | ||
{header} | ||
<span className={clsx(styles.icon, {[styles.expanded]: isExpanded})} /> | ||
</div> | ||
{isExpanded && <div className={styles.content}>{children}</div>} | ||
</div> | ||
); | ||
return ( | ||
<div className={styles.collapsibleContent}> | ||
<div className={clsx(styles.header, { [styles.expanded]: isExpanded })} onClick={toggleExpansion}> | ||
{header} | ||
<span className={clsx(styles.icon, { [styles.expanded]: isExpanded })}> | ||
{isExpanded ? '👇' : '👈'} | ||
</span> | ||
</div> | ||
{isExpanded && <div className={styles.content}>{children}</div>} | ||
</div> | ||
); | ||
} | ||
|
||
CollapsibleContent.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
header: PropTypes.node.isRequired, | ||
children: PropTypes.node.isRequired, | ||
header: PropTypes.node.isRequired, | ||
}; | ||
|
||
export default CollapsibleContent; |
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
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