Skip to content

Commit 22787b1

Browse files
authored
Fix: Add _graphic._classes property (fixes #143)
1 parent 839c69c commit 22787b1

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ The 'visited' state of the grid item image. This setting is optional and does no
8181
##### alt (string):
8282
The alternative text for the item image. Assign [alt text](https://github.com/adaptlearning/adapt_framework/wiki/Providing-good-alt-text) to images that convey course content only. By default, the item is labelled by the `title` (if set), otherwise a generic 'Item 1, 2, 3 etc' label is applied, followed by the alternative text (if set).
8383

84+
##### \_classes (string):
85+
CSS class name(s) to be applied to the grid item.
86+
8487
#### \_itemGraphic (object):
8588
The itemGraphic object defines the image displayed in the popup that is shown when the item is selected by the learner. You only need to include this object if you want to display a different image in the popup. It contains the following settings:
8689

example.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"srcHover": "",
2929
"srcVisited": "",
3030
"alt": "",
31-
"title": "Grid Title 1"
31+
"title": "Grid Title 1",
32+
"_classes": ""
3233
},
3334
"_itemGraphic": {
3435
"src": "course/en/images/example.jpg",
@@ -46,7 +47,8 @@
4647
"srcHover": "",
4748
"srcVisited": "",
4849
"alt": "",
49-
"title": "Grid Title 2"
50+
"title": "Grid Title 2",
51+
"_classes": ""
5052
},
5153
"_itemGraphic": {
5254
"src": "course/en/images/example.jpg",
@@ -64,7 +66,8 @@
6466
"srcHover": "",
6567
"srcVisited": "",
6668
"alt": "",
67-
"title": "Grid Title 3"
69+
"title": "Grid Title 3",
70+
"_classes": ""
6871
},
6972
"_itemGraphic": {
7073
"src": "course/en/images/example.jpg",

templates/hotgrid.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ export default function Hotgrid(props) {
5555
{_items.map(({ _index, _graphic, _isVisited, _isActive }) =>
5656

5757
<div
58-
className="hotgrid__item"
58+
className={classes([
59+
'hotgrid__item',
60+
_graphic._classes
61+
])}
5962
role="listitem"
6063
key={_index}
6164
style={(_columns && hasColumnLayout) ?

0 commit comments

Comments
 (0)