mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 12:01:38 +00:00
Adjust the UI for third party notifications to include source
This commit is contained in:
parent
dd30b1686b
commit
5c0e1d0ec4
1 changed files with 34 additions and 11 deletions
|
|
@ -126,14 +126,24 @@ function Notification:render()
|
|||
buttonsX += (count - 1) * 5
|
||||
end
|
||||
|
||||
local paddingY, logoSize = 20, 32
|
||||
local paddingX, paddingY, logoSize = 24, 20, 32
|
||||
local sourceY = if self.props.source then logoSize + 5 else 0
|
||||
local sourceX = if self.props.source then TextService:GetTextSize(
|
||||
self.props.source,
|
||||
15,
|
||||
Enum.Font.GothamMedium,
|
||||
Vector2.new(350, 15)
|
||||
).X + logoSize + 5 else 0
|
||||
local actionsY = if self.props.actions then 35 else 0
|
||||
local contentX = math.max(textBounds.X, buttonsX)
|
||||
local contentX =
|
||||
math.max(textBounds.X, buttonsX, sourceX)
|
||||
+ (if self.props.thirdParty then 0 else logoSize + 3)
|
||||
+ 2
|
||||
|
||||
local size = self.binding:map(function(value)
|
||||
return UDim2.fromOffset(
|
||||
(35 + 40 + contentX) * value,
|
||||
5 + actionsY + paddingY + math.max(logoSize, textBounds.Y)
|
||||
(paddingX + contentX) * value,
|
||||
5 + actionsY + sourceY + paddingY + math.max(logoSize, textBounds.Y)
|
||||
)
|
||||
end)
|
||||
|
||||
|
|
@ -154,8 +164,8 @@ function Notification:render()
|
|||
size = UDim2.new(1, 0, 1, 0),
|
||||
}, {
|
||||
Contents = e("Frame", {
|
||||
Size = UDim2.new(0, 35 + contentX, 1, -paddingY),
|
||||
Position = UDim2.new(0, 0, 0, paddingY / 2),
|
||||
Size = UDim2.new(1, 0, 1, 0),
|
||||
Position = UDim2.new(0, 0, 0, 0),
|
||||
BackgroundTransparency = 1
|
||||
}, {
|
||||
Logo = e("ImageLabel", {
|
||||
|
|
@ -166,6 +176,19 @@ function Notification:render()
|
|||
Position = UDim2.new(0, 0, 0, 0),
|
||||
AnchorPoint = Vector2.new(0, 0),
|
||||
}),
|
||||
Source = if self.props.source then e("TextLabel", {
|
||||
Text = self.props.source,
|
||||
Font = Enum.Font.GothamMedium,
|
||||
TextSize = 15,
|
||||
TextColor3 = theme.Notification.InfoColor,
|
||||
TextTransparency = transparency,
|
||||
TextXAlignment = Enum.TextXAlignment.Left,
|
||||
TextTruncate = Enum.TextTruncate.AtEnd,
|
||||
|
||||
Size = UDim2.new(1, -logoSize - 5, 0, logoSize),
|
||||
Position = UDim2.fromOffset(logoSize + 5, 0),
|
||||
BackgroundTransparency = 1,
|
||||
}) else nil,
|
||||
Message = e("TextLabel", {
|
||||
Text = self.props.text,
|
||||
Font = Enum.Font.GothamMedium,
|
||||
|
|
@ -176,9 +199,7 @@ function Notification:render()
|
|||
TextWrapped = true,
|
||||
|
||||
Size = UDim2.new(0, textBounds.X, 0, textBounds.Y),
|
||||
Position = UDim2.fromOffset(35, 0),
|
||||
|
||||
LayoutOrder = 1,
|
||||
Position = if self.props.thirdParty then UDim2.fromOffset(0, logoSize + 5) else UDim2.fromOffset(logoSize + 3, 0),
|
||||
BackgroundTransparency = 1,
|
||||
}),
|
||||
Actions = if self.props.actions then e("Frame", {
|
||||
|
|
@ -199,8 +220,10 @@ function Notification:render()
|
|||
}),
|
||||
|
||||
Padding = e("UIPadding", {
|
||||
PaddingLeft = UDim.new(0, 17),
|
||||
PaddingRight = UDim.new(0, 15),
|
||||
PaddingLeft = UDim.new(0, paddingX / 2),
|
||||
PaddingRight = UDim.new(0, paddingX / 2),
|
||||
PaddingTop = UDim.new(0, paddingY / 2),
|
||||
PaddingBottom = UDim.new(0, paddingY / 2),
|
||||
}),
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue