2018-07-10 10:08:42 +02:00
|
|
|
import React from 'react';
|
2019-01-27 09:48:45 +09:00
|
|
|
import { Components, registerComponent } from 'meteor/vulcan:core';
|
2018-07-10 10:08:42 +02:00
|
|
|
|
2018-08-07 15:37:51 +09:00
|
|
|
const parseUrl = value => {
|
2019-01-27 09:48:45 +09:00
|
|
|
return value && value.toString().slice(0, 4) === 'http' ? (
|
|
|
|
<a href={value} target="_blank">
|
|
|
|
{value}
|
|
|
|
</a>
|
|
|
|
) : (
|
|
|
|
value
|
|
|
|
);
|
2018-12-31 15:22:17 +09:00
|
|
|
};
|
2018-08-07 15:37:51 +09:00
|
|
|
|
2019-01-27 09:48:45 +09:00
|
|
|
const StaticComponent = ({ inputProperties, itemProperties }) => (
|
|
|
|
<Components.FormItem {...inputProperties} {...itemProperties}>
|
|
|
|
<div>{parseUrl(inputProperties.value)}</div>
|
|
|
|
</Components.FormItem>
|
2018-07-10 10:08:42 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
registerComponent('FormComponentStaticText', StaticComponent);
|