react-native-ios-utilities
Version:
Utilities for react-native + iOS and wrappers for using swift together with fabric/paper + JSI
80 lines (78 loc) • 2.18 kB
JavaScript
"use strict";
import * as React from 'react';
import { StyleSheet, View, Text } from 'react-native';
import { Colors } from "../misc/Colors.js";
/**
* ```
* ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
* .─────────────.
* │ Title ( Pill Title ) │
* `─────────────'
* │ Subtitle... │
* ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
* ```
*/
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export function CardTitle(props) {
const hasTitle = props.title != null;
const cardPillWrapper = {
marginLeft: hasTitle ? 10 : 0
};
return /*#__PURE__*/_jsxs(React.Fragment, {
children: [/*#__PURE__*/_jsxs(View, {
style: [styles.cardTitleContainer, {
marginTop: props.extraMarginTop ?? 0
}],
children: [/*#__PURE__*/_jsx(Text, {
style: styles.cardTitle,
children: props.title ?? ''
}), props.pillTitle && /*#__PURE__*/_jsx(View, {
style: [styles.cardPillWrapper, cardPillWrapper],
children: /*#__PURE__*/_jsx(View, {
style: styles.cardPillContainer,
children: /*#__PURE__*/_jsx(Text, {
style: styles.cardPillTitleText,
numberOfLines: 1,
children: props.pillTitle
})
})
})]
}), props.subtitle && /*#__PURE__*/_jsx(Text, {
style: styles.cardSubtitleText,
children: props.subtitle ?? 'subtitle'
})]
});
}
;
const styles = StyleSheet.create({
cardTitleContainer: {
flexDirection: 'row',
alignItems: 'center'
},
cardTitle: {
fontSize: 16,
fontWeight: '600'
},
cardPillWrapper: {
flex: 1,
alignItems: 'flex-start'
},
cardPillContainer: {
backgroundColor: Colors.BLUE.A400,
paddingHorizontal: 10,
paddingVertical: 5,
borderRadius: 10
},
cardPillTitleText: {
color: 'white',
fontWeight: '600',
fontSize: 14
},
cardSubtitleText: {
marginTop: 7,
fontWeight: '300',
fontSize: 12,
color: 'rgba(0,0,0,0.5)'
}
});
//# sourceMappingURL=CardTitle.js.map