Skip to content

Commit

Permalink
chore: modify text on group detail page (#62)
Browse files Browse the repository at this point in the history
* chore(group): modify text of contact box

* fix: adjust text on group detail page
  • Loading branch information
JohnsonMao committed Jul 21, 2024
1 parent 5c9f06a commit 4fe25c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion components/Group/detail/Contact/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function ContactButton({
id={contactId}
value={contact}
onChange={(e) => setContact(e.target.value)}
placeholder="寫下您的聯繫資訊,如 e-mail、line、Facebook、Instagram 等等。"
placeholder="寫下您的聯絡資訊,初次聯繫建議提供「想公開的社群媒體帳號、email」即可。"
/>
</div>

Expand Down
4 changes: 3 additions & 1 deletion components/Group/detail/OrganizerCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ function OrganizerCard({ data = {}, isLoading }) {
ROLE.find(({ key }) => data?.user?.roleList?.includes(key))?.label ||
'暫無資料';
const location =
data?.user?.location === 'tw' ? '台灣' : data?.user?.location;
data?.user?.location === 'tw'
? '台灣'
: data?.user?.location.replace('台灣', '').split('@').join(' ');

return (
<>
Expand Down
18 changes: 5 additions & 13 deletions components/Group/detail/TeamInfoCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,47 +46,39 @@ const StyledItem = styled.div`
}
`;

const format = (value) =>
Array.isArray(value) ? value.filter(Boolean).join('、') : value;

const labels = [
{
key: 'category',
icon: categorySvg.src,
text: '學習領域',
format: (v) => (Array.isArray(v) ? v.join('、') : v),
},
{
key: 'area',
icon: locationSvg.src,
text: '地點',
format: (v) => (Array.isArray(v) ? v.join('、') : v),
},
{ key: 'time', icon: clockSvg.src, text: '時間' },
{ key: 'partnerStyle', icon: personSvg.src, text: '想找的夥伴' },
{
key: 'partnerEducationStep',
icon: bachelorCapSvg.src,
text: '適合的教育階段',
format: (v) => (Array.isArray(v) ? v.join('、') : v),
},
];

function TeamInfoCard({ data = {}, isLoading }) {
return labels.map(
({ key, icon, text, format }) =>
({ key, icon, text }) =>
data[key] && (
<StyledItem key={key}>
<h3>
<img src={icon} alt={`${text} icon`} />
{text}
</h3>
<p>
{isLoading ? (
<Skeleton animation="wave" />
) : typeof format === 'function' ? (
format(data[key])
) : (
data[key]
)}
</p>
<p>{isLoading ? <Skeleton animation="wave" /> : format(data[key])}</p>
</StyledItem>
),
);
Expand Down

0 comments on commit 4fe25c9

Please sign in to comment.