-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1537 from cozy/tabs-section-header
- v117.3.0
- v117.2.2
- v117.2.1
- v117.2.0
- v117.1.0
- v117.0.0
- v116.0.0
- v115.1.0
- v115.0.2
- v115.0.1
- v115.0.0
- v114.0.1
- v114.0.0
- v113.9.0
- v113.8.0
- v113.7.1
- v113.7.0
- v113.6.0
- v113.5.0
- v113.4.0
- v113.3.0
- v113.2.0
- v113.1.0
- v113.0.0
- v112.3.0
- v112.2.0
- v112.1.0
- v112.0.0
- v111.21.0
- v111.20.0
- v111.19.0
- v111.18.1
- v111.18.0
- v111.17.0
- v111.16.0
- v111.15.2
- v111.15.1
- v111.15.0
- v111.14.0
- v111.13.0
- v111.12.0
- v111.11.0
- v111.10.0
- v111.9.0
- v111.8.1
- v111.8.0
- v111.7.0
- v111.6.0
- v111.5.0
- v111.4.0
- v111.3.1
- v111.3.0
- v111.2.0
- v111.1.1
- v111.1.0
- v111.0.0
- v110.8.2
- v110.8.1
- v110.8.0
- v110.7.1
- v110.7.0
- v110.6.0
- v110.5.0
- v110.4.0
- v110.3.0
- v110.2.0
- v110.1.1
- v110.1.0
- v110.0.1
- v110.0.0
- v109.2.0
- v109.1.1
- v109.1.0
- v109.0.2
- v109.0.1
- v109.0.0
- v108.1.0
- v108.0.0
- v107.4.1
- v107.4.0
- v107.3.0
- v107.2.0
- v107.1.0
- v107.0.0
- v106.9.0
- v106.8.0
- v106.7.0
- v106.6.0
- v106.5.0
- v106.4.0
- v106.3.0
- v106.2.0
- v106.1.1
- v106.1.0
- v106.0.0
- v105.12.0
- v105.11.0
- v105.10.2
- v105.10.1
- v105.10.0
- v105.9.1
- v105.9.0
- v105.8.0
- v105.7.0
- v105.6.0
- v105.5.0
- v105.4.0
- v105.3.1
- v105.3.0
- v105.2.1
- v105.2.0
- v105.1.0
- v105.0.2
- v105.0.1
- v105.0.0
- v104.3.0
- v104.2.0
- v104.1.0
- v104.0.0
- v103.12.0
- v103.11.1
- v103.11.0
- v103.10.0
- v103.9.0
- v103.8.2
- v103.8.1
- v103.8.0
- v103.7.0
- v103.6.2
- v103.6.1
- v103.6.0
- v103.5.0
- v103.4.0
- v103.3.1
- v103.3.0
- v103.2.0
- v103.1.1
- v103.1.0
- v103.0.0
- v102.2.1
- v102.2.0
- v102.1.1
- v102.1.0
- v102.0.0
- v101.2.0
- v101.1.1
- v101.1.0
- v101.0.0
- v100.2.0
- v100.1.0
- v100.0.0
- v99.0.4
- v99.0.3
- v99.0.2
- v99.0.1
- v99.0.0
- v98.2.0
- v98.1.1
- v98.1.0
- v98.0.0
- v97.2.1
- v97.2.0
- v97.1.0
- v97.0.0
- v96.2.0
- v96.1.1
- v96.1.0
- v96.0.0
- v95.11.1
- v95.11.0
- v95.10.0
- v95.9.0
- v95.8.0
- v95.7.0
- v95.6.0
- v95.5.0
- v95.4.0
- v95.3.0
- v95.2.0
- v95.1.0
- v95.0.0
- v94.1.0
- v94.0.0
- v93.5.0
- v93.4.0
- v93.3.0
- v93.2.0
- v93.1.1
- v93.1.0
- v93.0.1
- v93.0.0
- v92.4.0
- v92.3.0
- v92.2.0
- v92.1.0
- v92.0.1
- v92.0.0
- v91.2.0
- v91.1.1
- v91.1.0
- v91.0.0
- v90.7.1
- v90.7.0
- v90.6.0
- v90.5.0
- v90.4.0
- v90.3.0
- v90.2.0
- v90.1.0
- v90.0.0
- v89.1.0
- v89.0.0
- v88.6.0
- v88.5.0
- v88.4.0
- v88.3.0
- v88.2.1
- v88.2.0
- v88.1.1
- v88.1.0
- v88.0.0
- v87.0.0
- v86.3.0
- v86.2.0
- v86.1.0
- v86.0.0
- v85.9.0
- v85.8.1
- v85.8.0
- v85.7.0
- v85.6.0
- v85.5.0
- v85.4.0
- v85.3.1
- v85.3.0
- v85.2.0
- v85.1.0
- v85.0.2
- v85.0.1
- v85.0.0
- v84.3.0
- v84.2.0
- v84.1.6
- v84.1.5
- v84.1.4
- v84.1.3
- v84.1.2
- v84.1.1
- v84.1.0
- v84.0.0
- v83.4.0
- v83.3.0
- v83.2.0
- v83.1.1
- v83.1.0
- v83.0.0
- v82.14.0
- v82.13.0
- v82.12.0
- v82.11.0
- v82.10.0
- v82.9.0
- v82.8.0
- v82.7.0
- v82.6.1
- v82.6.0
- v82.5.1
- v82.5.0
- v82.4.0
- v82.3.0
- v82.2.0
- v82.1.2
- v82.1.1
- v82.1.0
- v82.0.0
- v81.9.0
- v81.8.0
- v81.7.0
- v81.7.0-muiv5
- v81.6.1
- v81.6.0
- v81.5.0
- v81.4.0
- v81.3.0
- v81.2.1
- v81.2.0
- v81.1.0
- v81.0.0
- v80.3.0
- v80.2.1
- v80.2.0
- v80.1.1
- v80.1.0
- v80.0.2
- v80.0.1
- v80.0.0
- v79.5.0
- v79.4.0
- v79.3.0
- v79.2.3
- v79.2.2
- v79.2.1
- v79.2.0
- v79.1.0
- v79.0.0
- v78.1.1
- v78.1.0
- v78.0.0
- v77.10.0
- v77.9.2
- v77.9.1
- v77.9.0
- v77.8.0
- v77.7.1
- v77.7.0
- v77.6.0
- v77.5.0
- v77.4.0
- v77.3.0
- v77.2.0
- v77.1.0
- v77.0.0
- v76.2.0
- v76.1.0
- v76.0.0
- v75.6.1
- v75.6.0
- v75.5.0
- v75.4.1
- v75.4.0
- v75.3.0
- v75.2.0
- v75.1.0
- v75.0.1
- v75.0.0
- v74.7.0
- v74.6.1
- v74.6.0
- v74.5.0
- v74.4.2
- v74.4.1
- v74.4.0
- v74.3.0
- v74.2.0
- v74.1.0
- v74.0.0
- v73.3.0
- v73.2.3
- v73.2.2
- v73.2.1
- v73.2.0
- v73.1.0
- v73.0.1
- v73.0.0
- v72.1.0
- v72.0.0
- v71.0.0
- v70.7.0
- v70.6.2
- v70.6.1
- v70.6.0
- v70.5.1
- v70.5.0
- v70.4.2
- v70.4.1
- v70.4.0
- v70.3.0
- v70.2.4
- v70.2.3
- v70.2.2
- v70.2.1
- v70.2.0
- v70.1.0
- v70.0.0
- v69.4.1
- v69.4.0
- v69.3.0
- v69.2.0
- v69.1.0
- v69.0.0
- v68.9.1
- v68.9.0
- v68.8.0
- v68.7.0
- v68.6.0
- v68.5.1
- v68.5.0
- v68.4.0
- v68.3.1
- v68.3.0
- v68.2.0
- v68.1.1
- v68.1.0
- v68.0.1
- v68.0.0
- v67.0.4
- v67.0.3
- v67.0.2
- v67.0.1
- v67.0.0
- v66.2.4
- v66.2.3
- v66.2.2
- v66.2.1
- v66.2.0
- v66.1.0
- v66.0.0
- v65.1.3
- v65.1.2
- v65.1.1
- v65.1.0
- v65.0.1
- v65.0.0
- v64.0.0
- v63.0.0
- v62.12.0
- v62.11.0
- v62.10.0
- v62.9.1
- v62.9.0
- v62.8.0
- v62.7.0
- v62.6.0
- v62.5.3
- v62.5.2
- v62.5.1
- v62.5.0
- v62.4.3
- v62.4.2
- v62.4.1
- v62.4.0
- v62.3.0
- v62.2.0
- v62.1.4
- v62.1.3
- v62.1.2
- v62.1.1
- v62.1.0
- v62.0.4
- v62.0.3
- v62.0.2
- v62.0.1
- v62.0.0
- v61.1.1
- v61.1.0
- v61.0.0
- v60.12.0
- v60.11.0
- v60.10.1
- v60.10.0
- v60.9.1
- v60.9.0
- v60.8.2
- v60.8.1
- v60.8.0
- v60.7.0
- v60.6.1
- v60.6.0
- v60.5.0
- v60.4.0
- v60.3.0
- v60.2.0
- v60.1.0
- v60.0.0
- v59.3.0
- v59.2.0
- v59.1.0
- v59.0.0
- v58.5.1
- v58.5.0
- v58.4.1
- v58.4.0
- v58.3.0
- v58.2.0
- v58.1.2
- v58.1.1
- v58.1.0
- v58.0.0
- v57.10.0
- v57.9.2
- v57.9.1
- v57.9.0
- v57.8.0
- v57.7.0
- v57.6.0
- v57.5.5
- v57.5.4
- v57.5.3
- v57.5.2
- v57.5.1
- v57.5.0
- v57.4.0
- v57.3.1
- v57.3.0
- v57.2.1
- v57.2.0
- v57.1.0
- v57.0.0
- v56.0.1
- v56.0.0
- v55.0.0
- v54.1.1
- v54.1.0
- v54.0.0
- v53.0.0
- v52.0.1
- v52.0.0
- v51.12.0
- v51.11.0
- v51.10.0
- v51.9.1
- v51.9.0
- v51.8.0
- v51.7.1
- v51.7.0
- v51.6.0
- v51.5.2
- v51.5.1
- v51.5.0
- v51.4.0
- v51.3.1
- v51.3.0
- v51.2.1
- v51.2.0
- v51.1.0
- v51.0.2
- v51.0.1
- v51.0.0
- v50.9.3
- v50.9.2
- v50.9.1
- v50.9.0
- v50.8.0
- v50.7.0
- v50.6.0
- v50.5.0
- v50.4.0
- v50.3.0
- v50.2.0
- v50.1.2
- v50.1.1
- v50.1.0
- v50.0.0
- v49.5.0
- v49.4.0
- v49.3.0
- v49.2.0
- v49.1.1
- v49.1.0
- v49.0.4
- v49.0.3
- v49.0.2
- v49.0.1
- v49.0.0
- v48.0.0
- v47.6.0
- v47.5.1
- v47.5.0
- v47.4.0
- v47.3.0
- v47.2.0
- v47.1.0
- v47.0.1
- v47.0.0
- v46.1.0
- v46.0.0
- v45.5.0
- v45.4.1
- v45.4.0
- v45.3.0
- v45.2.0
- v45.1.0
- v45.0.0
- v44.14.0
- v44.13.0
- v44.12.0
- v44.11.0
- v44.10.1
- v44.10.0
- v44.9.0
- v44.8.0
- v44.7.0
- v44.6.0
- v44.5.0
- v44.4.0
- v44.3.0
- v44.2.0
- v44.1.3
- v44.1.2
- v44.1.1
- v44.1.0
- v44.0.5
- v44.0.4
- v44.0.3
- v44.0.2
- v44.0.1
- v44.0.0
- v43.6.0
- v43.5.0
- v43.4.0
- v43.3.0
- v43.2.0
- v43.1.0
- v43.0.0
- v42.4.1
- v42.4.0
- v42.3.0
- v42.2.0
- v42.1.1
- v42.1.0
- v42.0.1
- v42.0.0
- v41.4.1
- v41.4.0
- v41.3.1
- v41.3.0
- v41.2.0
- v41.1.0
- v41.0.0
- v40.10.0
- v40.9.1
- v40.9.0
- v40.8.0
- v40.7.2
- v40.7.1
- v40.7.0
- v40.6.1
- v40.6.0
- v40.5.0
- v40.4.2
- v40.4.1
- v40.4.0
- v40.3.0
- v40.2.1
- v40.2.0
- v40.1.1
- v40.1.0
- v40.0.0
- v39.2.0
- v39.1.0
- v39.0.0
- v38.3.1
- v38.3.0
- v38.2.0
- v38.1.0
- v38.0.1
- v38.0.0
- v37.9.0
- v37.8.0
- v37.7.0
- v37.6.0
- v37.5.0
- v37.4.0
- v37.3.2
- v37.3.1
- v37.3.0
- v37.2.1
- v37.2.0
- v37.1.0
- v37.0.1
- v37.0.0
- v36.6.2
- v36.6.1
- v36.6.0
- v36.5.0
- v36.4.0
- v36.3.1
- v36.3.0
- v36.2.0
- v36.1.2
- v36.1.1
- v36.1.0
- v36.0.0
- v35.46.0
- v35.45.0
- v35.44.0
Showing
6 changed files
with
197 additions
and
118 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
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,126 @@ | ||
A navigation list is used to present choices of navigation to the user. | ||
It will be rendered slightly differently on desktop or mobile, with | ||
desktop sections rendered into cards while on mobile, it will rendered | ||
simply as a list with subheaders. | ||
|
||
``` | ||
import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme'; | ||
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'cozy-ui/transpiled/react/Tabs'; | ||
import Icon from 'cozy-ui/transpiled/react/Icon'; | ||
import ListItem from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItem' | ||
import ListItemIcon from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItemIcon' | ||
import ListItemText from 'cozy-ui/transpiled/react/ListItemText' | ||
import ListItemSecondaryAction from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItemSecondaryAction' | ||
import useBreakpoints, { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints'; | ||
import ListSubheader from '../MuiCozyTheme/ListSubheader' | ||
import NavigationList, { | ||
NavigationListSection | ||
} from 'cozy-ui/transpiled/react/NavigationList' | ||
import Stack from 'cozy-ui/transpiled/react/Stack' | ||
const NavigationListExample = ({ style }) => { | ||
return ( | ||
<NavigationList style={style}> | ||
<NavigationListSection> | ||
<ListSubheader>General</ListSubheader> | ||
<ListItem> | ||
<ListItemIcon> | ||
<Icon icon="gear" width="24" height="24" /> | ||
</ListItemIcon> | ||
<ListItemText primaryText="General settings" /> | ||
<ListItemSecondaryAction> | ||
<Icon | ||
icon="right" | ||
width="24" | ||
height="24" | ||
className="u-mr-1 u-coolGrey" | ||
/> | ||
</ListItemSecondaryAction> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemIcon> | ||
<Icon icon="people" width="24" height="24" /> | ||
</ListItemIcon> | ||
<ListItemText | ||
primaryText="User preferences" | ||
secondaryText="Notifications and theme" | ||
/> | ||
<ListItemSecondaryAction> | ||
<Icon | ||
icon="right" | ||
width="24" | ||
height="24" | ||
className="u-mr-1 u-coolGrey" | ||
/> | ||
</ListItemSecondaryAction> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemIcon> | ||
<Icon icon="trash" className="u-error" width="24" height="24" /> | ||
</ListItemIcon> | ||
<ListItemText | ||
primaryText="Delete account" | ||
primaryTextClassName="u-error" | ||
secondaryTextClassName="u-error" | ||
secondaryText="Permanently delete all your data" | ||
/> | ||
</ListItem> | ||
</NavigationListSection> | ||
<NavigationListSection> | ||
<ListSubheader>Accounts</ListSubheader> | ||
<ListItem> | ||
<ListItemIcon> | ||
<Icon icon="bank" width="24" height="24" /> | ||
</ListItemIcon> | ||
<ListItemText primaryText="Bank accounts" /> | ||
<ListItemSecondaryAction> | ||
<Icon | ||
icon="right" | ||
width="24" | ||
height="24" | ||
className="u-mr-1 u-coolGrey" | ||
/> | ||
</ListItemSecondaryAction> | ||
</ListItem> | ||
</NavigationListSection> | ||
</NavigationList> | ||
) | ||
} | ||
const tabsNavigationListStyle = { marginTop: -1 }; | ||
const TabsExample = () => { | ||
const { isMobile } = useBreakpoints() | ||
return ( | ||
<> | ||
<p> | ||
With tabs, it is necessary to tweak a bit the style to prevent a double border on mobile. | ||
</p> | ||
<Tabs initialActiveTab='navlist'> | ||
<TabList> | ||
<Tab name='navlist'>Navigation list</Tab> | ||
<Tab name='details'>Details</Tab> | ||
</TabList> | ||
<TabPanels> | ||
<TabPanel className={isMobile ? 'u-pt-0' : null} name='navlist'> | ||
<NavigationListExample style={tabsNavigationListStyle} /> | ||
</TabPanel> | ||
<TabPanel name='details'> | ||
{ content.ada.short } | ||
</TabPanel> | ||
</TabPanels> | ||
</Tabs> | ||
</> | ||
) | ||
} | ||
<BreakpointsProvider> | ||
<MuiCozyTheme> | ||
<Stack spacing='xl'> | ||
<NavigationListExample /> | ||
<TabsExample /> | ||
</Stack> | ||
</MuiCozyTheme> | ||
</BreakpointsProvider> | ||
``` |
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,33 @@ | ||
import React from 'react' | ||
import List from 'cozy-ui/transpiled/react/MuiCozyTheme/List' | ||
import Stack from 'cozy-ui/transpiled/react/Stack' | ||
import Card from 'cozy-ui/transpiled/react/Card' | ||
import useBreakpoints from 'cozy-ui/transpiled/react/hooks/useBreakpoints' | ||
|
||
const NavigationList = ({ children, style }) => { | ||
const { isMobile } = useBreakpoints() | ||
return isMobile ? ( | ||
<List style={style}>{children}</List> | ||
) : ( | ||
<DesktopSectionWrapper style={style}>{children}</DesktopSectionWrapper> | ||
) | ||
} | ||
|
||
export default NavigationList | ||
|
||
const DesktopSection = ({ children }) => ( | ||
<Card className="u-p-0 u-ov-hidden">{children}</Card> | ||
) | ||
|
||
const DesktopSectionWrapper = ({ children }) => ( | ||
<Stack spacing="s">{children}</Stack> | ||
) | ||
|
||
export const NavigationListSection = ({ children }) => { | ||
const { isMobile } = useBreakpoints() | ||
return isMobile ? ( | ||
<>{children}</> | ||
) : ( | ||
<DesktopSection>{children}</DesktopSection> | ||
) | ||
} |
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