-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added image for UI types, fixed UI for input selections, used selecta…
…ble cards component
- Loading branch information
Showing
28 changed files
with
162 additions
and
49 deletions.
There are no files selected for viewing
95 changes: 95 additions & 0 deletions
95
packages/react-components/react-components/stories/ComponentSelector/SelectionCard.tsx
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,95 @@ | ||
import * as React from 'react'; | ||
import { makeStyles, Button, Caption1, tokens, Text, Checkbox } from '@fluentui/react-components'; | ||
import { MoreHorizontal20Regular } from '@fluentui/react-icons'; | ||
import { Card, CardHeader, CardPreview, CardProps } from '@fluentui/react-components'; | ||
|
||
const resolveAsset = (asset: string) => { | ||
const ASSET_URL = 'https://fluent2websitecdn.azureedge.net/cdn/'; | ||
|
||
return `${ASSET_URL}${asset}`; | ||
}; | ||
|
||
const useStyles = makeStyles({ | ||
main: { | ||
gap: '16px', | ||
display: 'flex', | ||
flexWrap: 'wrap', | ||
margin: '5px 10px 10px 5px', | ||
}, | ||
|
||
card: { | ||
width: '250px', | ||
maxWidth: '100%', | ||
height: 'fit-content', | ||
}, | ||
|
||
caption: { | ||
color: tokens.colorNeutralForeground3, | ||
}, | ||
|
||
cardImage: { | ||
borderRadius: tokens.borderRadiusXLarge, | ||
border: '1px solid var(--colorNeutralStroke1, #e1dfdd)', | ||
filter: 'grayscale(100%) brightness(95%)', | ||
opacity: 0.5, | ||
|
||
'&:hover': { | ||
filter: 'grayscale(0%) brightness(100%)', | ||
opacity: 1, | ||
}, | ||
}, | ||
cardImageSelected: { | ||
borderRadius: tokens.borderRadiusXLarge, | ||
border: '1px solid var(--colorNeutralStroke1, #e1dfdd)', | ||
filter: 'grayscale(0%) brightness(100%)', | ||
opacity: 1, | ||
}, | ||
|
||
grayBackground: { | ||
padding: '0 15px 15px', | ||
}, | ||
}); | ||
|
||
export const SelectionCard = props => { | ||
const styles = useStyles(); | ||
const [selected, setSelected] = React.useState(false); | ||
const [hovered, setHovered] = React.useState(false); | ||
|
||
const linkRef = React.useRef<HTMLAnchorElement>(null); | ||
|
||
const setCheckboxState = React.useCallback(({ selected, checked }, setFn) => setFn(!!(selected || checked)), []); | ||
|
||
const onSelectedCardChange = React.useCallback( | ||
(_, state) => { | ||
setCheckboxState(state, setSelected); | ||
props.onChange(_, state, props.name); | ||
}, | ||
[setCheckboxState], | ||
); | ||
|
||
return ( | ||
<div className={styles.main}> | ||
<Card | ||
className={styles.card} | ||
{...props} | ||
floatingAction={<Checkbox onChange={onSelectedCardChange} checked={selected} />} | ||
selected={selected} | ||
onSelectionChange={onSelectedCardChange} | ||
onMouseOver={() => setHovered(true)} | ||
onMouseOut={() => setHovered(false)} | ||
> | ||
<CardHeader | ||
header={<Text weight="semibold">BASIC INPUTS</Text>} | ||
description={<Caption1 className={styles.caption}>{props.displayName}</Caption1>} | ||
/> | ||
<CardPreview className={styles.grayBackground}> | ||
<img | ||
className={selected || hovered ? styles.cardImageSelected : styles.cardImage} | ||
src={resolveAsset(props.image)} | ||
alt="Presentation Preview" | ||
/> | ||
</CardPreview> | ||
</Card> | ||
</div> | ||
); | ||
}; |
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
3 changes: 2 additions & 1 deletion
3
...mponents/react-components/stories/ComponentSelector/components-definitions/Accordion.json
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,5 +1,6 @@ | ||
{ | ||
"name": "Accordion", | ||
"component": "Accordion", | ||
"attributes": ["expandable", "tabbable", "navigationByTabKey", "interactive"] | ||
"attributes": ["expandable", "tabbable", "navigationByTabKey", "interactive"], | ||
"img": "overview_accordion.B8eJ_Qlv.png" | ||
} |
3 changes: 2 additions & 1 deletion
3
...ponents/react-components/stories/ComponentSelector/components-definitions/ButtonBase.json
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,4 +1,5 @@ | ||
{ | ||
"name": "ButtonBase", | ||
"attributes": ["staysOnPage", "navigationByTabKey", "interactive"] | ||
"attributes": ["staysOnPage", "navigationByTabKey", "interactive"], | ||
"img": "overview_button.Baa-fciS.png" | ||
} |
3 changes: 2 additions & 1 deletion
3
...omponents/react-components/stories/ComponentSelector/components-definitions/Checkbox.json
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,5 +1,6 @@ | ||
{ | ||
"name": "Checkbox", | ||
"component": "Checkbox", | ||
"attributes": ["multipleChoices", "notOnOrOff", "toggle", "notInsideMenu", "navigationByTabKey", "interactive"] | ||
"attributes": ["multipleChoices", "notOnOrOff", "toggle", "notInsideMenu", "navigationByTabKey", "interactive"], | ||
"img": "overview_checkbox.C4LCt4a7.png" | ||
} |
3 changes: 2 additions & 1 deletion
3
...mponents/react-components/stories/ComponentSelector/components-definitions/InfoLabel.json
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,5 +1,6 @@ | ||
{ | ||
"name": "InfoLabel", | ||
"component": "InfoLabel", | ||
"attributes": ["interactiveContent", "onClick", "navigationByTabKey", "interactive"] | ||
"attributes": ["interactiveContent", "onClick", "navigationByTabKey", "interactive"], | ||
"img": "overview_placeholder.DKLLlbq1.png" | ||
} |
3 changes: 2 additions & 1 deletion
3
...ct-components/react-components/stories/ComponentSelector/components-definitions/Link.json
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,5 +1,6 @@ | ||
{ | ||
"name": "Link", | ||
"component": "Link", | ||
"attributes": ["singleAction", "navigatesToPage", "navigationByTabKey", "interactive"] | ||
"attributes": ["singleAction", "navigatesToPage", "navigationByTabKey", "interactive"], | ||
"img": "overview_link.gTR54kn-.png" | ||
} |
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
3 changes: 2 additions & 1 deletion
3
...omponents/react-components/stories/ComponentSelector/components-definitions/ListBase.json
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,5 +1,6 @@ | ||
{ | ||
"name": "ListBase", | ||
"attributes": ["narratesPosition", "singleColumn"], | ||
"note": "Component not available yet, under development." | ||
"note": "Component not available yet, under development.", | ||
"img": "overview_menu.DZ_QmfGO.png" | ||
} |
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
3 changes: 2 additions & 1 deletion
3
...omponents/react-components/stories/ComponentSelector/components-definitions/MenuBase.json
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,4 +1,5 @@ | ||
{ | ||
"name": "MenuBase", | ||
"attributes": ["insideMenu", "navigationByArrowKeys", "narratesPosition", "interactive"] | ||
"attributes": ["insideMenu", "navigationByArrowKeys", "narratesPosition", "interactive"], | ||
"img": "overview_menu.DZ_QmfGO.png" | ||
} |
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
3 changes: 2 additions & 1 deletion
3
...components/react-components/stories/ComponentSelector/components-definitions/TabList.json
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,5 +1,6 @@ | ||
{ | ||
"name": "TabList", | ||
"component": "TabList", | ||
"attributes": ["interactive", "navigationByArrowKeys", "narratesPosition"] | ||
"attributes": ["interactive", "navigationByArrowKeys", "narratesPosition"], | ||
"img": "overview_tablist.CTZsc6f-.png" | ||
} |
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
3 changes: 2 additions & 1 deletion
3
...mponents/react-components/stories/ComponentSelector/components-definitions/TableBase.json
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,4 +1,5 @@ | ||
{ | ||
"name": "TableBase", | ||
"attributes": ["columnsAndRows", "narratesPosition"] | ||
"attributes": ["columnsAndRows", "narratesPosition"], | ||
"img": "overview_tablist.CTZsc6f-.png" | ||
} |
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
3 changes: 2 additions & 1 deletion
3
...components/react-components/stories/ComponentSelector/components-definitions/Tooltip.json
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,5 +1,6 @@ | ||
{ | ||
"name": "Tooltip", | ||
"component": "Tooltip", | ||
"attributes": ["nonInteractiveContent", "onHover", "navigationByTabKey", "interactive"] | ||
"attributes": ["nonInteractiveContent", "onHover", "navigationByTabKey", "interactive"], | ||
"img": "overview_tooltip.DzdzrdMi.png" | ||
} |
3 changes: 2 additions & 1 deletion
3
...ct-components/react-components/stories/ComponentSelector/components-definitions/Tree.json
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,5 +1,6 @@ | ||
{ | ||
"name": "Tree", | ||
"component": "Tree", | ||
"extends": "TreeBase" | ||
"extends": "TreeBase", | ||
"img": "overview_accordion.B8eJ_Qlv.png" | ||
} |
3 changes: 2 additions & 1 deletion
3
...omponents/react-components/stories/ComponentSelector/components-definitions/TreeBase.json
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,4 +1,5 @@ | ||
{ | ||
"name": "TreeBase", | ||
"attributes": ["interactive", "navigationByArrowKeys", "hierarchical", "narratesPosition"] | ||
"attributes": ["interactive", "navigationByArrowKeys", "hierarchical", "narratesPosition"], | ||
"img": "overview_accordion.B8eJ_Qlv.png" | ||
} |
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