This repository was archived by the owner on Mar 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathmedia-object.js
67 lines (59 loc) · 1.86 KB
/
media-object.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import React from 'react';
import PropTypes from 'prop-types';
import { HorizontalAlignments } from '../enums';
import { GeneralPropTypes, FlexboxPropTypes, createClassName, generalClassNames, removeProps, objectKeys, objectValues } from '../utils';
/**
* Media object component.
*
* @param {Object} props
* @returns {Object}
*/
export const MediaObject = (props) => {
const className = createClassName(
props.noDefaultClassName ? null : 'media-object',
props.className,
{
'stack-for-small': props.stackForSmall
},
generalClassNames(props)
);
const passProps = removeProps(props, objectKeys(MediaObject.propTypes));
return <div {...passProps} className={className}/>;
};
MediaObject.propTypes = {
...GeneralPropTypes,
...FlexboxPropTypes,
stackForSmall: PropTypes.bool
};
/**
* Media object section component.
*
* @param {Object} props
* @returns {Object}
*/
export const MediaObjectSection = (props) => {
const className = createClassName(
props.noDefaultClassName ? null : 'media-object-section',
props.className,
{
'align-self-center': props.alignment === HorizontalAlignments.CENTER,
'align-self-right': props.alignment === HorizontalAlignments.RIGHT,
'align-self-justify': props.alignment === HorizontalAlignments.JUSTIFY,
'align-self-spaced': props.alignment === HorizontalAlignments.SPACED,
'main-section': props.isMain,
'middle': props.isMiddle,
'bottom': props.isBottom
},
generalClassNames(props)
);
const passProps = removeProps(props, objectKeys(MediaObjectSection.propTypes));
return <div {...passProps} className={className}/>;
};
MediaObjectSection.propTypes = {
...GeneralPropTypes,
...FlexboxPropTypes,
alignment: PropTypes.oneOf(objectValues(HorizontalAlignments)),
isMain: PropTypes.bool,
isMiddle: PropTypes.bool,
isBottom: PropTypes.bool
};