Skip to content

Commit

Permalink
Add focus highlight sampler
Browse files Browse the repository at this point in the history
Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com)
  • Loading branch information
juwonjeong committed Apr 16, 2024
1 parent 00cfb1e commit 073cfaa
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
17 changes: 17 additions & 0 deletions samples/sampler/stories/qa/Spotlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Heading from '@enact/sandstone/Heading';
import FormCheckboxItem from '@enact/sandstone/FormCheckboxItem';
import Input from '@enact/sandstone/Input';
import Item from '@enact/sandstone/Item';
import Image from '@enact/sandstone/Image';
import Picker from '@enact/sandstone/Picker';
import Popup from '@enact/sandstone/Popup';
import RadioItem from '@enact/sandstone/RadioItem';
Expand All @@ -27,6 +28,7 @@ import {Component, cloneElement} from 'react';
import css from './Spotlight.module.less';

import docs from '../../images/icon-enact-docs.png';
import {svgGenerator} from '../helper/svg';

const Container = SpotlightContainerDecorator({enterTo: 'last-focused'}, 'div');

Expand Down Expand Up @@ -501,6 +503,21 @@ NavigatingIntoOverflowContainers.parameters = {
}
};

const SpottableDiv = Spottable(Skinnable('div'));

export const FocusHighlight = () => (
<Row>
<SpottableDiv className={css.spottableDiv1}>
<Image className={css.image} src={svgGenerator(360, 240, 'd8d8d8', '6e6e6e', '360 X 240')} />
</SpottableDiv>
<SpottableDiv className={css.spottableDiv2}>
<Image className={css.image} src={svgGenerator(360, 240, '7ed31d', 'ffffff', '360 X 240')} />
</SpottableDiv>
</Row>
);

FocusHighlight.storyName = 'Spottable with Focus Highlight';

export const KitchenSink = (args) => (
<Column>
<Cell component="p" shrink>
Expand Down
23 changes: 23 additions & 0 deletions samples/sampler/stories/qa/Spotlight.module.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import "~@enact/sandstone/styles/mixins.less";
@import "~@enact/sandstone/styles/skin.less";

.spottableitem {
Expand All @@ -10,3 +11,25 @@
});
});
}

.spottableDiv1 {
.applySkins({
.sand-focus-highlight();
});
.focus({
transform: scale(1.1);
});
& .image {
margin: 0;
}
}

.spottableDiv2 {
.applySkins({
.sand-focus-highlight(image);
});

.focus({
transform: scale(1.1);
});
}

0 comments on commit 073cfaa

Please sign in to comment.