Skip to content

Commit

Permalink
Add support to configure the text font in modals (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper committed Feb 13, 2022
1 parent 881342f commit 24f5bb7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Release: dd.mm.yyyy
#### Modal

- New: Property `hasShadow` for whether the modal has a shadow.
- New: Property `font` for the font name used for the text ([#158](https://github.com/kasper/phoenix/issues/158)).
- New: Property `isInput` for whether the modal behaves as an input modal ([#163](https://github.com/kasper/phoenix/issues/163)).
- New: Property `inputPlaceholder` for the placeholder string that will be displayed when the input is empty ([#163](https://github.com/kasper/phoenix/issues/163)).
- New: Property `textDidChange` callback function to call when the input modal’s text field value changes ([#163](https://github.com/kasper/phoenix/issues/163)).
Expand Down
3 changes: 2 additions & 1 deletion Phoenix/ModalWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="fontName" keyPath="self.font" id="IWK-dI-mLP"/>
<binding destination="-2" name="fontSize" keyPath="self.weight" previousBinding="IWK-dI-mLP" id="bmn-Kk-zcg"/>
<binding destination="-2" name="editable" keyPath="self.isInput" id="1T6-Bi-8Xd"/>
<binding destination="-2" name="value" keyPath="self.text" id="b1H-8L-8X6">
<dictionary key="options">
<bool key="NSContinuouslyUpdatesValue" value="YES"/>
</dictionary>
</binding>
<binding destination="-2" name="fontSize" keyPath="self.weight" id="cKK-hg-40t"/>
<outlet property="delegate" destination="-2" id="9es-G1-SKC"/>
</connections>
</textField>
Expand Down
2 changes: 2 additions & 0 deletions Phoenix/PHModalWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@property BOOL hasShadow;
@property NSImage *icon;
@property (copy) NSString *text;
@property (copy) NSString *font;
@property BOOL isInput;
@property (copy) NSString *inputPlaceholder;
@property JSValue *textDidChange;
Expand Down Expand Up @@ -52,6 +53,7 @@
@property BOOL hasShadow;
@property NSImage *icon;
@property (copy) NSString *text;
@property (copy) NSString *font;
@property BOOL isInput;
@property (copy) NSString *inputPlaceholder;
@property JSValue *textDidChange;
Expand Down
1 change: 1 addition & 0 deletions Phoenix/PHModalWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ - (instancetype) init {
self.appearance = PHModalWindowControllerAppearanceDark;
self.hasShadow = YES;
self.text = @"";
self.font = @"System";
self.inputPlaceholder = @"";
}

Expand Down
2 changes: 2 additions & 0 deletions docs/docs/api/17-modal.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Modal implements Identifiable
property boolean hasShadow
property Image icon
property String text
property String font
property boolean isInput
property String inputPlaceholder
property Function textDidChange
Expand Down Expand Up @@ -46,6 +47,7 @@ end
### 3.0.0+

- `hasShadow` property for whether the modal has a shadow, by default `true`
- `font` dynamic property for the font name used for the text, by default `System`
- `isInput` property for whether the modal behaves as an input modal, by default `false`
- `inputPlaceholder` property for the placeholder string that will be displayed when the input is empty, by default ``
- `textDidChange` callback function to call when the input modal’s text field value changes, receives the value as the first argument for the callback
Expand Down

0 comments on commit 24f5bb7

Please sign in to comment.