@codecademy/brand 1.20.0-alpha.92ea2b64b6.0 → 1.20.0-alpha.a23896d48a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AppHeader/AppHeaderElements/AppHeaderLinkSections/index.js +0 -0
- package/dist/DropdownButton/index.d.ts +51 -302
- package/dist/DropdownButton/index.js +7 -7
- package/dist/LearningOutcomeTile/index.d.ts +8 -1
- package/dist/LearningOutcomeTile/index.js +92 -79
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/stories/Molecules/DropdownButton.stories.d.ts +5 -0
- package/dist/stories/Molecules/DropdownButton.stories.js +177 -3
- package/dist/stories/Molecules/LearningOutcomeTile.stories.d.ts +0 -1
- package/dist/stories/Molecules/LearningOutcomeTile.stories.js +25 -192
- package/package.json +2 -2
- package/dist/AppBarDeprecated/styles/index.module.scss +0 -39
- package/dist/EditorialImage/styles.module.scss +0 -36
- package/dist/GlobalFooter/FooterNavLinks/assets/download-on-the-app-store.svg +0 -45
- package/dist/GlobalFooter/FooterNavLinks/assets/get-it-on-google-play.png +0 -0
- package/dist/LearningOutcomeBadges/LearningOutcomeLevelBadge.d.ts +0 -18
- package/dist/LearningOutcomeBadges/LearningOutcomeLevelBadge.js +0 -57
- package/dist/LearningOutcomeBadges/LearningOutcomeLowAssessmentBadge.d.ts +0 -10
- package/dist/LearningOutcomeBadges/LearningOutcomeLowAssessmentBadge.js +0 -35
- package/dist/LearningOutcomeBadges/index.d.ts +0 -2
- package/dist/LearningOutcomeBadges/index.js +0 -2
- package/dist/LearningOutcomePopover/index.d.ts +0 -10
- package/dist/LearningOutcomePopover/index.js +0 -125
- package/dist/LearningOutcomeTile/Tile.d.ts +0 -7
- package/dist/LearningOutcomeTile/Tile.js +0 -79
- package/dist/LearningOutcomeTile/types.d.ts +0 -47
- package/dist/LearningOutcomeTile/types.js +0 -11
- package/dist/Loading/styles.module.scss +0 -131
- package/dist/NotFoundContent/404.svg +0 -1
- package/dist/assets/darkQuotes.svg +0 -1
- package/dist/assets/dots.svg +0 -1
- package/dist/assets/lightQuotes.svg +0 -1
- package/dist/assets/navyQuotes.svg +0 -5
- package/dist/assets/orange_squiggle.svg +0 -1
- package/dist/png.d.ts +0 -4
- package/dist/react-freezeframe.d.ts +0 -1
- package/dist/stories/Molecules/LearningOutcomeLevelBadge.stories.d.ts +0 -6
- package/dist/stories/Molecules/LearningOutcomeLevelBadge.stories.js +0 -20
- package/dist/stories/Molecules/LearningOutcomeLowAssessmentBadge.stories.d.ts +0 -6
- package/dist/stories/Molecules/LearningOutcomeLowAssessmentBadge.stories.js +0 -10
- package/dist/stories/Molecules/LearningOutcomePopover.stories.d.ts +0 -5
- package/dist/stories/Molecules/LearningOutcomePopover.stories.js +0 -39
- package/dist/svg.d.ts +0 -8
- package/dist/theme.d.ts +0 -5
|
@@ -1,114 +1,127 @@
|
|
|
1
1
|
import _styled from "@emotion/styled/base";
|
|
2
|
-
import {
|
|
2
|
+
import { Box, FlexBox, Text } from '@codecademy/gamut';
|
|
3
3
|
import { SmallCheckIcon } from '@codecademy/gamut-icons';
|
|
4
4
|
import { variant } from '@codecademy/gamut-styles';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
|
+
var Progress = /*#__PURE__*/function (Progress) {
|
|
7
|
+
Progress["notStarted"] = "notStarted";
|
|
8
|
+
Progress["inProgress"] = "inProgress";
|
|
9
|
+
Progress["completed"] = "completed";
|
|
10
|
+
return Progress;
|
|
11
|
+
}(Progress || {});
|
|
12
|
+
const tileStyles = {
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
borderRadius: 'md',
|
|
16
|
+
borderColor: 'border-tertiary',
|
|
17
|
+
cursor: 'default',
|
|
18
|
+
position: 'relative'
|
|
19
|
+
};
|
|
20
|
+
const hoverVariants = hover => variant({
|
|
21
|
+
prop: 'progress',
|
|
22
|
+
variants: {
|
|
23
|
+
[Progress.notStarted]: {
|
|
24
|
+
'&:hover': {
|
|
25
|
+
bg: hover ? 'background-hover' : undefined
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
[Progress.inProgress]: {
|
|
29
|
+
'&:hover': {
|
|
30
|
+
bg: hover ? 'background-hover' : undefined
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
[Progress.completed]: {
|
|
34
|
+
'&:hover': {
|
|
35
|
+
bg: hover ? 'primary-hover' : undefined
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const sizeVariants = size => variant({
|
|
41
|
+
prop: 'progress',
|
|
42
|
+
base: {
|
|
43
|
+
border: size === 'small' ? 'none' : 2
|
|
44
|
+
},
|
|
45
|
+
variants: {
|
|
46
|
+
[Progress.notStarted]: {
|
|
47
|
+
width: size === 'small' ? 32 : 40,
|
|
48
|
+
height: size === 'small' ? 24 : 40
|
|
49
|
+
},
|
|
50
|
+
[Progress.inProgress]: {
|
|
51
|
+
width: size === 'small' ? 32 : 40,
|
|
52
|
+
height: size === 'small' ? 24 : 40
|
|
53
|
+
},
|
|
54
|
+
[Progress.completed]: {
|
|
55
|
+
width: size === 'small' ? 20 : 40,
|
|
56
|
+
height: size === 'small' ? 20 : 40
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const Tile = /*#__PURE__*/_styled(FlexBox, {
|
|
12
61
|
target: "ei97hfv0",
|
|
13
|
-
label: "
|
|
62
|
+
label: "Tile"
|
|
14
63
|
})(props => ({
|
|
64
|
+
...hoverVariants(props.hover)(props),
|
|
65
|
+
...sizeVariants(props.size)(props),
|
|
15
66
|
...variant({
|
|
16
67
|
prop: 'progress',
|
|
17
68
|
base: {
|
|
18
|
-
|
|
69
|
+
...tileStyles
|
|
19
70
|
},
|
|
20
71
|
variants: {
|
|
21
72
|
[Progress.notStarted]: {
|
|
22
|
-
|
|
23
|
-
fontWeight: 400
|
|
73
|
+
bg: 'background-selected'
|
|
24
74
|
},
|
|
25
75
|
[Progress.inProgress]: {
|
|
26
|
-
|
|
27
|
-
fontWeight: props.isSmall ? 400 : 700
|
|
76
|
+
bg: 'background-selected'
|
|
28
77
|
},
|
|
29
|
-
[Progress.completed]: {
|
|
78
|
+
[Progress.completed]: {
|
|
79
|
+
bg: 'primary'
|
|
80
|
+
}
|
|
30
81
|
}
|
|
31
82
|
})(props)
|
|
32
|
-
}), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
33
|
-
const progressState =
|
|
34
|
-
if (
|
|
83
|
+
}), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9MZWFybmluZ091dGNvbWVUaWxlL2luZGV4LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF5RWEiLCJmaWxlIjoiLi4vLi4vc3JjL0xlYXJuaW5nT3V0Y29tZVRpbGUvaW5kZXgudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQm94LCBGbGV4Qm94LCBUZXh0IH0gZnJvbSAnQGNvZGVjYWRlbXkvZ2FtdXQnO1xuaW1wb3J0IHsgU21hbGxDaGVja0ljb24gfSBmcm9tICdAY29kZWNhZGVteS9nYW11dC1pY29ucyc7XG5pbXBvcnQgeyB2YXJpYW50IH0gZnJvbSAnQGNvZGVjYWRlbXkvZ2FtdXQtc3R5bGVzJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuZW51bSBQcm9ncmVzcyB7XG4gIG5vdFN0YXJ0ZWQgPSAnbm90U3RhcnRlZCcsXG4gIGluUHJvZ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QtY29udHJhc3RcIlxuICAgICAgICAgICAgYm9yZGVyUmFkaXVzPVwiZnVsbFwiXG4gICAgICAgICAgICBoZWlnaHQ9ezE2fVxuICAgICAgICAgICAgd2lkdGg9ezE2fVxuICAgICAgICAgICAgcG9zaXRpb249XCJhYnNvbHV0ZVwiXG4gICAgICAgICAgICB0b3A9XCItMjAlXCJcbiAgICAgICAgICAgIHJpZ2h0PVwiLTIwJVwiXG4gICAgICAgICAgLz5cbiAgICAgICAgKX1cbiAgICAgIDwvVGlsZT5cbiAgICA8Lz5cbiAgKTtcbn07XG4iXX0= */");
|
|
84
|
+
const progressState = progressPercentage => {
|
|
85
|
+
if (!progressPercentage || progressPercentage === 0) {
|
|
35
86
|
return Progress.notStarted;
|
|
36
87
|
}
|
|
37
|
-
if (
|
|
88
|
+
if (progressPercentage > 0 && progressPercentage < 100) {
|
|
38
89
|
return Progress.inProgress;
|
|
39
90
|
}
|
|
40
91
|
return Progress.completed;
|
|
41
92
|
};
|
|
42
93
|
export const LearningOutcomeTile = ({
|
|
43
|
-
|
|
44
|
-
|
|
94
|
+
assessmentPercentage,
|
|
95
|
+
progressPercentage,
|
|
45
96
|
hover = false,
|
|
46
|
-
popover = false,
|
|
47
97
|
size = 'normal'
|
|
48
98
|
}) => {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
percentComplete
|
|
55
|
-
} = learningOutcomeDetails;
|
|
56
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
57
|
-
const activeElRef = useRef(null);
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
if (isOpen) {
|
|
60
|
-
// If the popover is open, we want to focus the active element
|
|
61
|
-
activeElRef.current?.focus();
|
|
62
|
-
}
|
|
63
|
-
}, [isOpen]);
|
|
64
|
-
const popoverProps = popover && hover ? {
|
|
65
|
-
ref: activeElRef,
|
|
66
|
-
onMouseEnter: () => setIsOpen(true),
|
|
67
|
-
onMouseLeave: () => setIsOpen(false),
|
|
68
|
-
onFocus: () => setIsOpen(true),
|
|
69
|
-
// For keyboard users
|
|
70
|
-
onBlur: () => setIsOpen(false),
|
|
71
|
-
// Close on blur
|
|
72
|
-
'aria-describedby': `${id}-popover`
|
|
73
|
-
} : {};
|
|
74
|
-
const highestScore = popover ? learningOutcomeDetails?.highestScore : undefined;
|
|
75
|
-
const percentCompleteValue = percentComplete ?? 0;
|
|
76
|
-
const progress = progressState(percentCompleteValue);
|
|
77
|
-
const isCompleted = progress === Progress.completed;
|
|
78
|
-
const isSmall = size === 'small';
|
|
79
|
-
const hasLowLatestAssessment = Boolean(latestScore != null && latestScore < 70);
|
|
80
|
-
const showLowAssessmentDot = hasLowLatestAssessment && !isSmall;
|
|
81
|
-
const lowAssessmentLabel = hasLowLatestAssessment ? 'Most recent assessment score is below 70%, needs review. ' : '';
|
|
82
|
-
const defaultAriaLabel = `${learningOutcomeLabels[level]}: ${outcome} ${lowAssessmentLabel}Progress ${percentCompleteValue}% completed.`;
|
|
83
|
-
const evaluationValuesLabel = isOpen && (highestScore || latestScore) ? `Evaluation Values - ${highestScore ? `Highest assessment score ${highestScore}. ` : ''}${latestScore ? `Recent assessment score ${latestScore}.` : ''}` : '';
|
|
84
|
-
return /*#__PURE__*/_jsxs(Anchor, {
|
|
85
|
-
"aria-label": `${defaultAriaLabel} ${evaluationValuesLabel}`,
|
|
86
|
-
variant: "interface",
|
|
87
|
-
href: href,
|
|
88
|
-
...popoverProps,
|
|
89
|
-
children: [/*#__PURE__*/_jsxs(Tile, {
|
|
99
|
+
const lowAssessment = assessmentPercentage && assessmentPercentage < 70;
|
|
100
|
+
const progress = progressState(progressPercentage);
|
|
101
|
+
const progressText = progress === Progress.inProgress ? `${progressPercentage}%` : '';
|
|
102
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
103
|
+
children: /*#__PURE__*/_jsxs(Tile, {
|
|
90
104
|
hover: hover,
|
|
91
105
|
progress: progress,
|
|
92
106
|
size: size,
|
|
93
|
-
children: [
|
|
94
|
-
size:
|
|
107
|
+
children: [progress === Progress.completed ? /*#__PURE__*/_jsx(SmallCheckIcon, {
|
|
108
|
+
size: size === 'small' ? 12 : 16,
|
|
95
109
|
textColor: "background-contrast"
|
|
96
|
-
}) : /*#__PURE__*/_jsx(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
children:
|
|
100
|
-
}),
|
|
110
|
+
}) : /*#__PURE__*/_jsx(Text, {
|
|
111
|
+
fontSize: 14,
|
|
112
|
+
fontWeight: 700,
|
|
113
|
+
children: progressText
|
|
114
|
+
}), size !== 'small' && lowAssessment && /*#__PURE__*/_jsx(Box, {
|
|
115
|
+
bg: "orange-500",
|
|
116
|
+
border: 2,
|
|
117
|
+
borderColor: "background-contrast",
|
|
118
|
+
borderRadius: "full",
|
|
119
|
+
height: 16,
|
|
120
|
+
width: 16,
|
|
101
121
|
position: "absolute",
|
|
102
122
|
top: "-20%",
|
|
103
|
-
right: "-20%"
|
|
104
|
-
hasBorder: true
|
|
123
|
+
right: "-20%"
|
|
105
124
|
})]
|
|
106
|
-
})
|
|
107
|
-
activeElRef: activeElRef,
|
|
108
|
-
horizontalOffset: isSmall && isCompleted ? 159 : isSmall ? 153 : 150,
|
|
109
|
-
id: `${id}-popover`,
|
|
110
|
-
isOpen: isOpen,
|
|
111
|
-
learningOutcomeDetails: learningOutcomeDetails
|
|
112
|
-
})]
|
|
125
|
+
})
|
|
113
126
|
});
|
|
114
127
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -45,7 +45,6 @@ export * from './InfoCard';
|
|
|
45
45
|
export * from './Konamimojisplosion';
|
|
46
46
|
export * from './LandingPage';
|
|
47
47
|
export * from './LayoutMenu';
|
|
48
|
-
export * from './LearningOutcomeBadges';
|
|
49
48
|
export * from './LearningOutcomeCard';
|
|
50
49
|
export * from './LearningOutcomeTile';
|
|
51
50
|
export * from './lib/breakpointHooks';
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,6 @@ export * from './InfoCard';
|
|
|
45
45
|
export * from './Konamimojisplosion';
|
|
46
46
|
export * from './LandingPage';
|
|
47
47
|
export * from './LayoutMenu';
|
|
48
|
-
export * from './LearningOutcomeBadges';
|
|
49
48
|
export * from './LearningOutcomeCard';
|
|
50
49
|
export * from './LearningOutcomeTile';
|
|
51
50
|
export * from './lib/breakpointHooks';
|
|
@@ -4,3 +4,8 @@ declare const meta: Meta<typeof DropdownButton>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof DropdownButton>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
+
export declare const DropdownButtonTypes: Story;
|
|
8
|
+
export declare const DropdownButtonVariants: Story;
|
|
9
|
+
export declare const DropdownTextButtonSizes: Story;
|
|
10
|
+
export declare const DropdownIconButtonSizes: Story;
|
|
11
|
+
export declare const DropdownPopoverAlignment: Story;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Box, FlexBox } from '@codecademy/gamut';
|
|
2
|
+
import { SparkleIcon } from '@codecademy/gamut-icons';
|
|
1
3
|
import { DropdownButton } from '../../index';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
5
|
const items = [{
|
|
4
6
|
id: 'one',
|
|
5
7
|
text: 'I have an href',
|
|
@@ -9,25 +11,197 @@ const items = [{
|
|
|
9
11
|
text: 'I have an onClick',
|
|
10
12
|
// eslint-disable-next-line no-console
|
|
11
13
|
clickHandler: () => console.log('hi')
|
|
12
|
-
}
|
|
14
|
+
}];
|
|
15
|
+
const extraItems = [{
|
|
13
16
|
id: 'three',
|
|
14
17
|
text: 'I have an href & onClick',
|
|
15
18
|
href: '#',
|
|
16
19
|
// eslint-disable-next-line no-console
|
|
17
20
|
clickHandler: () => console.log('hi')
|
|
21
|
+
}, {
|
|
22
|
+
id: 'four',
|
|
23
|
+
text: 'I have an href & onClick & icon',
|
|
24
|
+
href: '#',
|
|
25
|
+
// eslint-disable-next-line no-console
|
|
26
|
+
clickHandler: () => console.log('hi'),
|
|
27
|
+
icon: SparkleIcon
|
|
18
28
|
}];
|
|
19
29
|
const meta = {
|
|
20
30
|
component: DropdownButton,
|
|
21
31
|
args: {
|
|
22
32
|
buttonType: 'fill',
|
|
23
|
-
dropdownItems: items
|
|
33
|
+
dropdownItems: items,
|
|
34
|
+
variant: 'primary'
|
|
35
|
+
},
|
|
36
|
+
parameters: {
|
|
37
|
+
controls: {
|
|
38
|
+
include: ['align', 'buttonType', 'children', 'dropDownItems', 'horizontalOffset', 'iconSize', 'isMenu', 'onClick', 'size', 'tipProps', 'variant', 'verticalOffset']
|
|
39
|
+
}
|
|
24
40
|
}
|
|
25
41
|
};
|
|
26
42
|
export default meta;
|
|
27
43
|
export const Default = {
|
|
44
|
+
args: {
|
|
45
|
+
dropdownItems: [...items, ...extraItems],
|
|
46
|
+
isMenu: false
|
|
47
|
+
},
|
|
28
48
|
render: args => /*#__PURE__*/_jsx(DropdownButton, {
|
|
29
49
|
...args,
|
|
30
50
|
children: "click me"
|
|
31
51
|
}),
|
|
32
52
|
name: 'DropdownButton'
|
|
53
|
+
};
|
|
54
|
+
export const DropdownButtonTypes = {
|
|
55
|
+
render: args => /*#__PURE__*/_jsxs(FlexBox, {
|
|
56
|
+
justifyContent: "space-between",
|
|
57
|
+
p: 40,
|
|
58
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
59
|
+
width: "fit-content",
|
|
60
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
61
|
+
...args,
|
|
62
|
+
buttonType: "fill",
|
|
63
|
+
children: "Fill"
|
|
64
|
+
})
|
|
65
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
66
|
+
width: "fit-content",
|
|
67
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
68
|
+
...args,
|
|
69
|
+
buttonType: "stroke",
|
|
70
|
+
children: "Stroke"
|
|
71
|
+
})
|
|
72
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
73
|
+
width: "fit-content",
|
|
74
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
75
|
+
...args,
|
|
76
|
+
buttonType: "text",
|
|
77
|
+
children: "Text"
|
|
78
|
+
})
|
|
79
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
80
|
+
width: "fit-content",
|
|
81
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
82
|
+
...args,
|
|
83
|
+
buttonType: "kebab"
|
|
84
|
+
})
|
|
85
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
86
|
+
width: "fit-content",
|
|
87
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
88
|
+
...args,
|
|
89
|
+
buttonType: "horizontalKebab"
|
|
90
|
+
})
|
|
91
|
+
})]
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
export const DropdownButtonVariants = {
|
|
95
|
+
render: args => /*#__PURE__*/_jsxs(FlexBox, {
|
|
96
|
+
justifyContent: "space-around",
|
|
97
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
98
|
+
width: "fit-content",
|
|
99
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
100
|
+
...args,
|
|
101
|
+
buttonType: "stroke",
|
|
102
|
+
children: "Stroke primary"
|
|
103
|
+
})
|
|
104
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
105
|
+
width: "fit-content",
|
|
106
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
107
|
+
...args,
|
|
108
|
+
buttonType: "stroke",
|
|
109
|
+
variant: "secondary",
|
|
110
|
+
children: "Stroke secondary"
|
|
111
|
+
})
|
|
112
|
+
})]
|
|
113
|
+
})
|
|
114
|
+
};
|
|
115
|
+
export const DropdownTextButtonSizes = {
|
|
116
|
+
render: args => /*#__PURE__*/_jsxs(FlexBox, {
|
|
117
|
+
justifyContent: "space-around",
|
|
118
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
119
|
+
alignSelf: "center",
|
|
120
|
+
width: "fit-content",
|
|
121
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
122
|
+
...args,
|
|
123
|
+
buttonType: "fill",
|
|
124
|
+
size: "small",
|
|
125
|
+
children: "Fill small"
|
|
126
|
+
})
|
|
127
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
128
|
+
alignSelf: "center",
|
|
129
|
+
width: "fit-content",
|
|
130
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
131
|
+
...args,
|
|
132
|
+
buttonType: "fill",
|
|
133
|
+
size: "normal",
|
|
134
|
+
children: "Fill normal"
|
|
135
|
+
})
|
|
136
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
137
|
+
alignSelf: "center",
|
|
138
|
+
width: "fit-content",
|
|
139
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
140
|
+
...args,
|
|
141
|
+
buttonType: "fill",
|
|
142
|
+
size: "large",
|
|
143
|
+
children: "Fill large"
|
|
144
|
+
})
|
|
145
|
+
})]
|
|
146
|
+
})
|
|
147
|
+
};
|
|
148
|
+
export const DropdownIconButtonSizes = {
|
|
149
|
+
render: args => /*#__PURE__*/_jsxs(FlexBox, {
|
|
150
|
+
row: true,
|
|
151
|
+
justifyContent: "space-around",
|
|
152
|
+
mt: 16,
|
|
153
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
154
|
+
alignSelf: "center",
|
|
155
|
+
width: "fit-content",
|
|
156
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
157
|
+
...args,
|
|
158
|
+
buttonType: "kebab",
|
|
159
|
+
size: "small",
|
|
160
|
+
iconSize: 12
|
|
161
|
+
})
|
|
162
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
163
|
+
alignSelf: "center",
|
|
164
|
+
width: "fit-content",
|
|
165
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
166
|
+
...args,
|
|
167
|
+
buttonType: "kebab",
|
|
168
|
+
size: "normal"
|
|
169
|
+
})
|
|
170
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
171
|
+
alignSelf: "center",
|
|
172
|
+
width: "fit-content",
|
|
173
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
174
|
+
...args,
|
|
175
|
+
buttonType: "kebab",
|
|
176
|
+
size: "large",
|
|
177
|
+
iconSize: 20
|
|
178
|
+
})
|
|
179
|
+
})]
|
|
180
|
+
})
|
|
181
|
+
};
|
|
182
|
+
export const DropdownPopoverAlignment = {
|
|
183
|
+
render: args => /*#__PURE__*/_jsxs(FlexBox, {
|
|
184
|
+
row: true,
|
|
185
|
+
justifyContent: "space-around",
|
|
186
|
+
mt: 16,
|
|
187
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
188
|
+
width: "fit-content",
|
|
189
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
190
|
+
...args,
|
|
191
|
+
buttonType: "text",
|
|
192
|
+
size: "small",
|
|
193
|
+
align: "left",
|
|
194
|
+
children: "Align left"
|
|
195
|
+
})
|
|
196
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
197
|
+
width: "fit-content",
|
|
198
|
+
children: /*#__PURE__*/_jsx(DropdownButton, {
|
|
199
|
+
...args,
|
|
200
|
+
buttonType: "text",
|
|
201
|
+
size: "small",
|
|
202
|
+
align: "right",
|
|
203
|
+
children: "Align right"
|
|
204
|
+
})
|
|
205
|
+
})]
|
|
206
|
+
})
|
|
33
207
|
};
|
|
@@ -5,6 +5,5 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof LearningOutcomeTile>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
7
|
export declare const WithLowAssessments: Story;
|
|
8
|
-
export declare const WithPopover: Story;
|
|
9
8
|
export declare const Small: Story;
|
|
10
9
|
export declare const DarkMode: Story;
|