suomifi-ui-components
Version:
Suomi.fi UI component library
67 lines (64 loc) • 2.9 kB
JavaScript
import { __rest, __assign, __makeTemplateObject } from 'tslib';
import React, { forwardRef } from 'react';
import { styled } from 'styled-components';
import classnames from 'classnames';
import { IconChevronRight } from 'suomifi-icons';
import { LinkListItemStyles } from './LinkListItem.baseStyles.js';
import { SuomifiThemeConsumer } from '../../theme/SuomifiThemeProvider/SuomifiThemeProvider.js';
import '../../theme/SuomifiTheme/SuomifiTheme.js';
import '../../theme/SpacingProvider/SpacingProvider.js';
import '../../../reset/HtmlA/HtmlA.js';
import '../../../reset/HtmlButton/HtmlButton.js';
import '../../../reset/HtmlDiv/HtmlDiv.js';
import '../../../reset/HtmlFieldSet/HtmlFieldSet.js';
import '../../../reset/HtmlH/HtmlH.js';
import '../../../reset/HtmlInput/HtmlInput.js';
import '../../../reset/HtmlLabel/HtmlLabel.js';
import '../../../reset/HtmlLegend/HtmlLegend.js';
import { HtmlLi } from '../../../reset/HtmlLi/HtmlLi.js';
import '../../../reset/HtmlNav/HtmlNav.js';
import '../../../reset/HtmlOl/HtmlOl.js';
import { HtmlSpan } from '../../../reset/HtmlSpan/HtmlSpan.js';
import '../../../reset/HtmlTextarea/HtmlTextarea.js';
import '../../../reset/HtmlUl/HtmlUl.js';
import '../../../reset/HtmlTable/HtmlTable.js';
import '../../../reset/HtmlTable/HtmlTableCaption.js';
import '../../../reset/HtmlTable/HtmlTableHeader.js';
import '../../../reset/HtmlTable/HtmlTableRow.js';
import '../../../reset/HtmlTable/HtmlTableBody.js';
import '../../../reset/HtmlTable/HtmlTableHeaderCell.js';
import '../../../reset/HtmlTable/HtmlTableCell.js';
var baseClassName = 'fi-link-list-item';
var listLinkClassNames = {
icon: "".concat(baseClassName, "_icon")
};
var StyledLinkListItem = styled(function (_a) {
var children = _a.children;
_a.theme;
var className = _a.className,
icon = _a.icon,
passProps = __rest(_a, ["children", "theme", "className", "icon"]);
return /*#__PURE__*/React.createElement(HtmlLi, __assign({}, passProps, {
className: classnames(baseClassName, className)
}), /*#__PURE__*/React.createElement(HtmlSpan, {
className: listLinkClassNames.icon
}, !!icon ? icon : /*#__PURE__*/React.createElement(IconChevronRight, null)), children);
}).withConfig({
componentId: "sc-g1wbr4-0"
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
var theme = _a.theme;
return LinkListItemStyles(theme);
});
var LinkListItem = /*#__PURE__*/forwardRef(function (props, ref) {
return /*#__PURE__*/React.createElement(SuomifiThemeConsumer, null, function (_a) {
var suomifiTheme = _a.suomifiTheme;
return /*#__PURE__*/React.createElement(StyledLinkListItem, __assign({
theme: suomifiTheme,
forwardedRef: ref
}, props));
});
});
LinkListItem.displayName = 'LinkListItem';
var templateObject_1;
export { LinkListItem };
//# sourceMappingURL=LinkListItem.js.map